XenAPI - XenForo PHP REST API

XenAPI - XenForo PHP REST API 1.4.2

No permission to download
When using getPost, I get the error "Fatal error: Call to a member function getData() on a non-object in /home/tekkify/public_html/api.php on line 2730". Any ideas?

Edit: Same happens with getThread.
 
I'm trying to use XenAPI to perform authentication for another application I'm working on, so this application and the website use the same usernames and passwords. I'm trying to use the Authenticate method, but I constantly get "(400) Bad Request" as a response. I've tried using both a raw URL in my web browser, and using a .NET WebClient from a small C# app. I've also tried against an internal XenForo install running on IIS 7.0 and my live website probably running in a sandboxed Linux VM.

The format I'm using is http://urlToMySite/forums/api?action=authenticate&username=MyUser&password=MyPass". Any ideas?
 
When using getPost, I get the error "Fatal error: Call to a member function getData() on a non-object in /home/tekkify/public_html/api.php on line 2730". Any ideas?

Edit: Same happens with getThread.
What parameters are you using?
 
I'm trying to use XenAPI to perform authentication for another application I'm working on, so this application and the website use the same usernames and passwords. I'm trying to use the Authenticate method, but I constantly get "(400) Bad Request" as a response. I've tried using both a raw URL in my web browser, and using a .NET WebClient from a small C# app. I've also tried against an internal XenForo install running on IIS 7.0 and my live website probably running in a sandboxed Linux VM.

The format I'm using is http://urlToMySite/forums/api?action=authenticate&username=MyUser&password=MyPass". Any ideas?
Does your web server replace .php? If not, you're missing a .php after "api".

Code:
http://urlToMySite/forums/api.php?action=authenticate&username=MyUser&password=MyPass
 
Does your web server replace .php? If not, you're missing a .php after "api".

Code:
http://urlToMySite/forums/api.php?action=authenticate&username=MyUser&password=MyPass

Sorry, that was a typo. I do have the .php in the url in my test code.
 
What does the server log of the web server say?
You're using the correct arguments

I checked my IIS logs and I don't see any errors. It looks something like this.

2014-01-23 23:33:25 192.168.128.129 GET /forums/api.php action=authenticate&username=MyUsername&password=MyPassword 80 - 192.168.128.132 Mozilla/5.0+(Windows+NT+6.3;+WOW64;+rv:26.0)+Gecko/20100101+Firefox/26.0 400 0 0 2074

This was on my internal test install, I have the same error on the live server presumably running some LAMP setup but I haven't figured out how to view Apache logs there yet.
 
I have not tried yet this addon, but the idea of it looks great! Went through all the posts in this thread and checked documentation.

I was thinking of a system which uses XenForo threads as comments for another website, and if I find time to start, this API will be great help.

Keep it up the good work!
 
I came across this while looking for a solution for using XF to auth another app and I have a question.

I skimmed the API docs and I don't see anything about re-using sessions.

Let's say I want to set up an XMPP server that auths from XenForo. The client would be embedded in a XenForo node which would connect to the remote XMPP server and the XMPP server would auth from XenForo and allow login to the chat server if the user is valid, using the forum username.

Do the users have to log in to the chat client separately for me to use the API or can I just use the existing session data from the forum login?
 
I have an API key, from a plugin/mod for my minecraft server, where do I put the API key that i have in the API.php?
 
@Contex

We put the api.php in the root of the XenForo installation, and ran this:
xenforo_Error.png


How do we get the API Key?

Thanks
 
Hi,

You should change api.php file. Find line #19

$options = array('api_key' => 'API_KEY');

just put any salt string here instead of API_KEY value. This should solve the issue you have.
 
Hi,

This is a great API, but I just have a problem.
I created 3 users. I don't have problem for 2 users (authenticate, and getUser with hash).
But with the last I created, authentification works, I get the hash, but the hash is incorrect.
For authentification I got :

https://xxxxx.com/api.php?action=authenticate&username=userx&password=azerty123
PHP:
{"hash":"$2a$10$1xRj4owE6WBM.v8ZObiNpOGY8d\/tDLA\/lTisRu8nTPZDV4Ic16TX6"}

And when I try to get user details with :
https://xxxxx.com/api.php?action=ge...BM.v8ZObiNpOGY8d\/tDLA\/lTisRu8nTPZDV4Ic16TX6
PHP:
{"error":6,"message":"\"userx:$2a$10$1xRj4owE6WBM.v8ZObiNpOGY8d\\\/tDLA\\\/lTisRu8nTPZDV4Ic16TX6\" is not a valid hash"}

Have you an idea please ?
 
Hi,

This is a great API, but I just have a problem.
I created 3 users. I don't have problem for 2 users (authenticate, and getUser with hash).
But with the last I created, authentification works, I get the hash, but the hash is incorrect.
For authentification I got :

https://xxxxx.com/api.php?action=authenticate&username=userx&password=azerty123
PHP:
{"hash":"$2a$10$1xRj4owE6WBM.v8ZObiNpOGY8d\/tDLA\/lTisRu8nTPZDV4Ic16TX6"}

And when I try to get user details with :
https://xxxxx.com/api.php?action=ge...BM.v8ZObiNpOGY8d\/tDLA\/lTisRu8nTPZDV4Ic16TX6
PHP:
{"error":6,"message":"\"userx:$2a$10$1xRj4owE6WBM.v8ZObiNpOGY8d\\\/tDLA\\\/lTisRu8nTPZDV4Ic16TX6\" is not a valid hash"}

Have you an idea please ?
I reckon XF updated their hashing methods (looks like PHPass) and I sadly do not have the time to update the project any further anymore as I have other projects that have deadlines.

I might look into it once I get the time.
 
I've noticed that the getUser returns a JSON object that does not have the user's email nor does it have the user's location.

The user's location is not a big deal, however, I am not sure why the user's email is not available in the object. Any ideas why? I'm not sure what the reasoning behind this is but one user (me) does have the email.
 
We're looking to build a very basic android app for our site, that's just the web version, plus xenforo alerts go to android notifications. Will this work for getting the alerts?
 
Top Bottom