XenAPI - XenForo PHP REST API

XenAPI - XenForo PHP REST API 1.4.2

No permission to download
Hey,

I've got three little problems ;)

First of all a stupid, general question.
Is it possible to include the API into the file which contains the website?
I have indeed tried it to include the main API-file but I received an error:
{"error":3,"message":"Missing argument: \"hash\""}

My second question is whether it is possible to get the current logged in user on this PC?
And my last question is more or less an error-message.

I'd tried out the login function (http://domain.tld/XenForoAPI.php?ac...ERNAME&password=PASSWORD&ip_address=IP-ADRESS) and received an error in the XenForo admin panel:
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry 'e267d1bd144f62714bc8efffcc6dc261' for key 'PRIMARY' - library/Zend/Db/Statement/Mysqli.php:214

I really hope you could help me with my problems :)

Best regards
Luca.
 
Hey,

I've got three little problems ;)

First of all a stupid, general question.
Is it possible to include the API into the file which contains the website?
Otherwise, you can't use the functions, can you?

My second question is whether it is possible to get the current logged in user on this PC?
And my last question is more or less an error-message.

I'd tried out the login function (http://domain.tld/XenForoAPI.php?ac...ERNAME&password=PASSWORD&ip_address=IP-ADRESS) and received an error in the XenForo admin panel:
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry 'e267d1bd144f62714bc8efffcc6dc261' for key 'PRIMARY' - library/Zend/Db/Statement/Mysqli.php:214

I really hope you could help me with my problems :)

Best regards
Luca.
1. In theory yes, you can use the XenAPI classes if you wish, but if you're trying to login an user from another website I suggest using the 1.4-dev PHP wrapper instead.
2. What do you mean regarding that, logged in on XenForo or on the PC?
3. Odd, what XF version are you running?
 
Thanks for your reply :)

1. Is it the wrapper you mentioned a few pages ago?
2. I want to get the user which is logged in into XenForo currently and print it out on the website. Therefore I need to include the API into the page but there is an error:
{"error":3,"message":"Missing argument: \"hash\""}
3. I'm running XenForo 1.5.1
 
Thanks for your reply :)

1. Is it the wrapper you mentioned a few pages ago?
2. I want to get the user which is logged in into XenForo currently and print it out on the website. Therefore I need to include the API into the page but there is an error:
{"error":3,"message":"Missing argument: \"hash\""}
3. I'm running XenForo 1.5.1
1. Correct, https://github.com/Contex/XenAPI/blob/dev-1.4/net/xenapi/XenAPI/examples/php/xen_api.php (do note you would have to use the 1.4-dev api.php instead if you use this wrapper (because of the login methods).
2. I suggest authenticating the user towards XenForo and storing the hash so that it can be reused. I might work on some kind of cookie usage in the future, but at the moment you must pass the hash parameter.
3. Odd, I'm not getting any error messages like that, I suggest rying the 1.4-dev branch (linked above) as it uses another method for login (a more correct method imho).
 
So I have to replace the main XenForoAPI.php with the xen_api.php, right?
No, you would have to grab the newest api.php from the 1.4-dev branch (link: https://github.com/Contex/XenAPI/blob/dev-1.4/net/xenapi/XenAPI/api.php) and put this in the root of your XF installation.
Then, put xen_api.php PHP wrapper (that I linked in the previous post) in your application/website, and use the functions from the wrapper to "login" the user (see example.php: https://github.com/Contex/XenAPI/blob/dev-1.4/net/xenapi/XenAPI/examples/php/example.php)

Let me know if that works.

Edit: see my post here regarding logging into XenForo via XenAPI: https://xenforo.com/community/threads/xenapi-xenforo-php-rest-api.34270/page-10#post-887423
 
No, you would have to grab the newest api.php from the 1.4-dev branch (link: https://github.com/Contex/XenAPI/blob/dev-1.4/net/xenapi/XenAPI/api.php) and put this in the root of your XF installation.
Then, put xen_api.php PHP wrapper (that I linked in the previous post) in your application/website, and use the functions from the wrapper to "login" the user (see example.php: https://github.com/Contex/XenAPI/blob/dev-1.4/net/xenapi/XenAPI/examples/php/example.php)

Let me know if that works.

Edit: see my post here regarding logging into XenForo via XenAPI: https://xenforo.com/community/threads/xenapi-xenforo-php-rest-api.34270/page-10#post-887423
I'd tried it but I got a blank page :(

What am I doing wrong?
 
Hi @Contex

How to create new thread with Content Tagging via API?

Please help me. It is very important with me. I can change the code if require.

Thanks so much!
 
Hi @Contex

How to create new thread with Content Tagging via API?

Please help me. It is very important with me. I can change the code if require.

Thanks so much!
I haven't had a chance to look at it yet but I assume you would just set the tags within the createThread method in the XenAPI class. You'll just have to check what XF 1.5 does in regards to this.
 
That feature would have to be added to the API, please make a feature request if you want it in the next version, I plan on working a bit on XenAPI today.
thanks brother for quick response

where should i make the feature request?
 
request made @Contex

my app will go live in 2-3 weeks so hopefully you can add the call before :(
I'll see if I can get the time to do it, but it shouldn't be hard for someone else to add it if they have a bit of knowledge of XF and PHP. I'll do my best to look at it today though.
 
I'll see if I can get the time to do it, but it shouldn't be hard for someone else to add it if they have a bit of knowledge of XF and PHP. I'll do my best to look at it today though.
damn today? will donate if that happens lol
 
Top Bottom