D
Deleted member 10469
Guest
Hello, rated performance and loading time of pages it gives what please?
I'll add an argument which will tell you how long it took to execute the request in the next version and run some tests to provide some dataHello, rated performance and loading time of pages it gives what please?
See http://xenforo.com/community/threads/xenapi-xenforo-rest-api.34270/#post-399071 for examples.Hello, I have a website (use Symfony2 frameworks), how use the Xenforo API for get a basic query please ?
Example:
Xenforo index:
C:/wamp/www/xenforo/*
WebSite index:
C:/wamp/www/Symfony2/web/*
In my code (in oriented Object), how access and use the xenforo api please ?
include('api.php?action=getAlerts&value=USERNAME&type=fetchAll&hash=USERNAME:HASH') ?
No, this is a REST API, which means that it only responses to HTTP requests.api.php?... with include ?
Have you a simple example for an basic query please ?
<?php
$contents = file_get_contents("http://www.example.com/api.php");
$json = json_decode($contents);
var_dump($json);
?>
{
"error": 3,
"message": "Missing argument: 'action'"
}
object(stdClass)#1 (2) { ["error"]=> int(3) ["message"]=> string(26) "Missing argument: 'action'" }
I haven't worked that much on it but I'll make sure to have it well documented when finished.
Either way, here are some simple uses:
Authentication
Code:api.php?action=authenticate&username=Contex&password=pass
This would return this error if wrong:
Code:{"error":5,"message":"Authentication error: Invalid username or password!"}
And if successful, it returns a hash:
Where x is the returned hash, you have to use this hash on every other action.Code:{"hash":"x"}
Examples of actions
Grabbing user information
The value parameter is the search string, e-mails, usernames and user id's work.
Would return a JSON object of the user information.Code:api.php?action=getUser&value=Contex&hash=x
Code:{"user_id":1,"username":"Contex","email":"me@contex.me","gender":"","custom_title":"","language_id":1,"timezone":"Europe\/Amsterdam","visible":1,"user_group_id":3,"secondary_group_ids":"2,7","message_count":159,"conversations_unread":0,"register_date":1333977020,"last_activity":1345149999,"trophy_points":28,"alerts_unread":0,"avatar_date":1342625592,"avatar_width":192,"avatar_height":192,"gravatar":"","user_state":"valid","is_moderator":1,"is_admin":1,"is_banned":0,"like_count":32,"warning_points":0,"friend_count":0,"personal_friend_count":0,"mood_id":20}
Grabbing user avatar
Returns the link to the user's avatar, if they have Gravatar enabled it would link that instead.Code:api.php?action=getAvatar&value=Contex&hash=x
The value parameter is the search string, e-mails, usernames and user id's work.
Code:{"avatar":"http:\/\/www.x.com\/data\/avatars\/m\/0\/1.jpg?1342625592"}
Searching for users
The value parameter is the search string, usernames and wildcards (use * as a wildcard) work.
Return a list of matched usernames.Code:api.php?action=getusers&value=Cont*&hash=x
Code:[{"username":"Contex"},{"username":"ContexTest"},{"username":"ContexTesting"}]
Grabbing group information
The value parameter is the search string, group id's and group names are both accepted.
Return the group information.Code:api.php?action=getgroup&value=Guest&hash=x
Code:{"user_group_id":1,"title":"Unregistered \/ Unconfirmed","display_style_priority":0,"username_css":"","user_title":"Guest"}
I haven't gotten around to add more content to it, but I've made the source open to everyone if they wish to contribute, I'll get around to it eventually.
Odd, didn't get an alert for this.Could this be used to create a Xenforo Single Sign On ?
Similar to this ...
http://vbsso.com/
Supported Platforms
WordPress 3.0/3.1/3.2/3.3/3.4/3.5
WordPress Multisite 3.0/3.1/3.2/3.3/3.4
Drupal 6.x, 7.x
Mediawiki 1.19.x, 1.20.x
I was working on something here, although it's not finished yet: https://github.com/Contex/XenAPI/wiki/ActionsHelpful Add-on ! Hope you provide us a complete white page soon !
Another small update:
- I've moved things around, the XenAPI is now independent of the REST API, making it possible to use XenAPI in your PHP includes.
- You can grab all the resources from the Resource Manager.
- You can grab all the resources submitted by an user.
- You can...
I can try to get the "orderby" and "order" added to the API for the next release, "getUsers" is just for search through usernames, I'll see if I can get things changed for the next release.OMG! this looks so good.
Question before I actually and try it out.
Can I use this to grab 10 members with most post ?
for example: api.php?action=getusers&orderby=postcount&direction=DESC
?
I might be able to contribute in the development, but before I would need to see how its actually working.
Is there any docs that says, what actions are available and arguments each action can take and values will it return ?
Thanks
{"error":17,"message":"The API key has not been changed, make sure you use another API key before using this API."}
Take a look at line #4 of the api.php: https://github.com/Contex/XenAPI/blob/master/net/xenapi/XenAPI/api.php#L20Hey contex, I just updated the api with the latest release. By simply replacing the api.php file in the root directory but now I am getting the following error
Code:{"error":17,"message":"The API key has not been changed, make sure you use another API key before using this API."}
Hope you can help.
Take a look at line #4 of the api.php: https://github.com/Contex/XenAPI/blob/master/net/xenapi/XenAPI/api.php#L20
Change this something else, or remove that line.
/api.php?action=authenticate&username=Shady&password=pass
{"error":1,"message":"Argument: \"hash\", is empty\/missing a value"}
Good catch, can't believe I didn't test that, I'll push a new version a couple of minutes with a fix.After removing that line I get these errors when I use some of the authenticate urls
Like this url
Code:/api.php?action=authenticate&username=Shady&password=pass
It gives me this error
Code:{"error":1,"message":"Argument: \"hash\", is empty\/missing a value"}
Fixed an issue with authentication requiring hash, thanks @faeronsayn!
We use essential cookies to make this site work, and optional cookies to enhance your experience.