Skip to content
Contex edited this page May 9, 2013 · 33 revisions

Here’s a complete list of all the different actions and their response.

For these examples I’m using these the following values:

Username Contex
User Hash 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
API Key d8e8fca2dc0f896fd7cb4cb0031ba249
Action Name Version Added Parameters Supported Summary
authenticate 1.0 performance Authenticates the user and returns the hash that the user has to use for future requests
getAddon 1.2 performance Returns any relevant information about the specified addon
getAddons 1.2 performance Returns a list of the installed addons
getActions 1.0 performance Returns a list of all the available actions and their permission levels
getAlerts 1.1 performance, grab_as Returns the alerts of the specified user
getAvatar 1.0 performance, grab_as Returns the avatar of the specified user
getGroup 1.0 performance Returns any relevant information about the specified group
getPost 1.3 performance, grab_as Returns any relevant information about the specified post
getPosts 1.3 performance, grab_as, order_by, order, limit Returns a list of posts
getProfilePost 1.3 performance, grab_as Returns any relevant information about the specified profile post
getProfilePosts 1.3 performance, grab_as, order_by, order, limit Returns a list of profile posts
getResource 1.2 performance Returns any relevant information about the specified resource
getResources 1.2 performance Returns a list of the resources
getStats 1.0 performance Returns a list of relevant stats items
getThread 1.3 performance, grab_as Returns any relevant information about the specified thread
getThreads 1.3 performance, grab_as, order_by, order, limit Returns a list of threads
getUser 1.0 performance, grab_as Returns any relevant information about the specified user
getUsers 1.0 performance, order_by, order, limit Searches through the usernames depending on the input
Error ID Error Message
0 Unknown error
1 Argument: “{ERROR}”, is empty/missing a value
2 “{ERROR}”, is not a supported action
3 Missing argument: “{ERROR}”
4 {ERROR} found with the argument: “{ERROR2}”
5 Authentication error: “{ERROR}”
6 “{ERROR}” is not a valid {ERROR2}
7 PLACEHOLDER
8 PLACEHOLDER
9 You are not permitted to use the “{ERROR}” action on others (remove the value argument)
10 You do not have permission to use the “{ERROR}” action
11 “{ERROR}” is a supported action but there is no code for it yet
12 “{ERROR}” is a unknown request method
13 “{ERROR}” is not an installed addon
14 “{ERROR}” is not an author of any resources
15 Could not find a resource with ID “{ERROR}”
16 Could not find a required model to perform this request: “{ERROR}”
17 The API key has not been changed, make sure you use another API key before using this API.
18 "{ERROR} is a unknown permission name, the request was terminated.
19 Could not find a thread with ID “{ERROR}”.
20 You do not have permissions to view {ERROR}.
21 The “{ERROR}” argument has to be a number.
22 The argument for “order_by”, “{ERROR}”, was not found in the list available order by list: “({ERROR2})”.

Additional parameters are parameters that can be added to each action.
Note that some actions might not support the parameter, for more information check the additional parameters list for each action.

Allows to grab the action as another user.

NOTE: This parameter gets ignored if an API key is not used. Usernames, emails and user ID’s can be used for the grab_as parameter.

Request:

api.php?action=ACTION&hash=API_KEY&grab_as=USERNAME

Example:

api.php?action=getAlerts&hash=____d8e8fca2dc0f896fd7cb4cb0031ba249____&grab_as=Contex

Adds performance related variables to the response.

Request: api.php?performance
Response:

{
  "error": 3,
  "message": "Missing argument: \"hash\"",
  "execution_time": 0.0040709972381592
}

Orders the results with the “order_by” parameter, check each action for more information about available order_by values.

NOTE: The value of the “order_by” parameter will be added to the response.

Error Codes:

Error ID Cause of error
1 The “order_by” parameter was set but empty
22 The “order_by” parameter was not found in the list of supported order_by parameters

See Error Codes for more information.

Requests:

api.php?action=ACTION&value=VALUE&hash=USERNAME:HASH&order_by=FIELD
api.php?action=ACTION&value=VALUE&hash=API_KEY&order_by=FIELD

Examples:

api.php?action=getUsers&value=Cont*&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08&order_by=message_count
api.php?action=getUsers&value=Cont*&hash=d8e8fca2dc0f896fd7cb4cb0031ba249&order_by=message_count

Response:

[
  {
    "user_id": 1,
    "username": "Contex",
    "message_count": 591
  },
  {
    "user_id": 3,
    "username": "ContexTest",
    "message_count": 5
  }
]

Orders the results with by the “order” parameter.

NOTE: This parameter requires the order_by parameter to be used as well, it will be ignored otherwise.
The value for the “order” parameter will default back to “descending” if an invalid value is requested.

Options for the “order” parameter are:

  • d/desc/descending: Orders the results in a descending order (10 → 0).
  • a/asc/ascending: Orders the results in a ascending order (0 → 10).

Requests:

api.php?action=ACTION&value=VALUE&hash=USERNAME:HASH&order_by=FIELD&order=ORDER
api.php?action=ACTION&value=VALUE&hash=API_KEY&order_by=FIELD&order=ORDER

Examples:

api.php?action=getUsers&value=Cont*&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08&order_by=message_count&order=ASC
api.php?action=getUsers&value=Cont*&hash=d8e8fca2dc0f896fd7cb4cb0031ba249&order_by=message_count&order=ASC

Response:

[
  {
    "user_id": 3,
    "username": "ContexTest",
    "message_count": 5
  },
  {
    "user_id": 1,
    "username": "Contex",
    "message_count": 591
  }
]

Adds a limit of how many results should be returned.

NOTE: Default value for the limit is by default 100, unless stated otherwise.

Error Codes:

Error ID Cause of error
1 The “limit” parameter was set but empty
21 The “limit” parameter was not a number

See Error Codes for more information.

Requests:

api.php?action=ACTION&value=VALUE&hash=USERNAME:HASH&limit=LIMIT
api.php?action=ACTION&value=VALUE&hash=API_KEY&limit=LIMIT

Examples:

api.php?action=getUsers&value=Cont*&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08&limit=1
api.php?action=getUsers&value=Cont*&hash=d8e8fca2dc0f896fd7cb4cb0031ba249&limit=1

Response:

[
  {
    "user_id": 1,
    "username": "Contex",
    "message_count": 591
  }
]

More information about each action

Authenticates the user and returns the hash that the user has to use for future requests.

Error Codes:

Error ID Cause of error
1 The “username” parameter was set but empty
1 The “password” parameter was set but empty
3 The “username” parameter was not set
3 The “password” parameter was not set
4 The “username” parameter is not a registered user
5 Wrong username or password

See Error Codes for more information.

Request: api.php?action=authenticate&username=USERNAME&password=PASSWORD
Example: api.php?action=authenticate&username=Contex&password=MyPassword
Response:

{
  "hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
}

Returns any relevant addon information about the specified by the “value” parameter.

NOTE: Only addon ID’s can be used for the “value” parameter. Addon ID’s can be found by using the ‘getAddons’ action.

Error Codes:

Error ID Cause of error
1 The “value” parameter was set but empty
3 Neither of the “value” and “hash” parameters were set
4 The “value” parameter is not installed

See Error Codes for more information.

Requests:

api.php?action=getAddon&value=ADDON_ID&hash=USERNAME:HASH
api.php?action=getAddon&value=ADDON_ID&hash=API_KEY

Examples:

api.php?action=getAddon&value=PostRating&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getAddon&value=PostRating&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "id": "PostRating",
  "title": "Post Ratings",
  "version": "1.5.0",
  "enabled": true,
  "url": "http:\/\/xenforo.com\/community\/resources\/post-ratings-taking-likes-to-the-next-level.410\/"
}

Returns all the installed addons, if type is not specified, default (all) is used instead.

Options for the “type” parameter are:

  • all: This is default, and will return all the addons, ignoring if they are installed or not.
  • enabled: Fetches all the addons that are enabled, ignoring the disabled ones.
  • disabled: Fetches all the addons that are disabled, ignoring the enabled ones.

Error Codes:

Error ID Cause of error
1 The “type” parameter was set but empty
3 The “hash” parameter was an API key but the “type” parameter was not set

See Error Codes for more information.

Requests:

api.php?action=getAddons&hash=USERNAME:HASH
api.php?action=getAddons&hash=API_KEY
api.php?action=getAddons&type=TYPE&hash=USERNAME:HASH
api.php?action=getAddons&type=TYPE&hash=API_KEY

Examples:

api.php?action=getAddons&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getAddons&hash=d8e8fca2dc0f896fd7cb4cb0031ba249
api.php?action=getAddons&type=enabled&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getAddons&type=enabled&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "count": 3,
  "addons": [
    {
      "id": "xenCODE_KeywordsMeta",
      "title": "'Keywords' Meta Tag by xenCODE",
      "version": "1.0.0",
      "enabled": true,
      "url": "http:\/\/xenforo.com\/community\/resources\/authors\/mr-goodie2shoes.11736\/"
    },
    {
      "id": "8thos_bar_flex",
      "title": "8thos Bar for Flexile",
      "version": "1.5",
      "enabled": true,
      "url": ""
    },
    {
      "id": "RichUsernameEverywhere",
      "title": "Add Username Style to Last Post",
      "version": "1.0.1",
      "enabled": true,
      "url": "http:\/\/www.madnaoki.com"
    }
  ]
}

Returns a list of all the available actions and their permission levels.

Request: api.php?action=getActions
Response:

{
  "getactions": "public",
  "getalerts": "private",
  "getuser": "authenticated",
  "getavatar": "public",
  "getusers": "public",
  "getgroup": "public",
  "authenticate": "public"
  "getaddons": "administrator"
  "getaddon": "administrator"
  "getresources": "administrator"
  "getresource": "administrator"
}

Grabs the alerts from the specified user, if type is not specified, default (recent alerts) is used instead.

NOTE: The “value” parameter will only work for the user itself and not on others users unless the permission parameter for the “getalerts” action is changed (default permission: private).

Options for the “type” parameter are:

  • fetchPopupItems: Fetch alerts viewed in the last options:alertsPopupExpiryHours hours.
  • fetchRecent: Fetch alerts viewed in the last options:alertExpiryDays days.
  • fetchAll: Fetch alerts regardless of their view_date.

For more information, see /library/XenForo/Model/Alert.php.

Error Codes:

Error ID Cause of error
1 The “value” parameter was set but empty
1 The “type” parameter was set but empty
3 Neither of the “value” and “hash” parameters were set
3 The “hash” parameter was an API key but the “value” parameter was not set
4 The “value” parameter was not a valid user (not registered)

See Error Codes for more information.

Requests:

api.php?action=getAlerts&hash=USERNAME:HASH
api.php?action=getAlerts&type=fetchAll&hash=USERNAME:HASH
api.php?action=getAlerts&value=USERNAME&hash=USERNAME:HASH
api.php?action=getAlerts&value=USERNAME&type=fetchAll&hash=USERNAME:HASH
api.php?action=getAlerts&value=USERNAME&hash=API_KEY
api.php?action=getAlerts&value=USERNAME&type=fetchAll&hash=API_KEY

Examples:

api.php?action=getAlerts&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getAlerts&type=fetchAll&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getAlerts&value=JohnDoe&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getAlerts&value=JohnDoe&type=fetchAll&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getAlerts&value=JohnDoe&hash=d8e8fca2dc0f896fd7cb4cb0031ba249
api.php?action=getAlerts&value=JohnDoe&type=fetchAll&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "alerts": {
    "563926": {
      "alert_id": 563926,
      "alerted_user_id": 1,
      "content_type": "user",
      "content_id": 1,
      "action": "following",
      "event_date": 1359927097,
      "view_date": 0,
      "extra_data": "",
      "alert_handler_class": "XenForo_AlertHandler_User",
      "content": {
        "user_id": 1,
        "username": "Contex",
        "email": "[email protected]",
        "gender": "",
        "custom_title": "",
        "language_id": 1,
        "style_id": 8,
        "timezone": "America\/Los_Angeles",
        "visible": 1,
        "user_group_id": 3,
        "secondary_group_ids": "2,4,7",
        "display_style_group_id": 3,
        "permission_combination_id": 45,
        "message_count": 135,
        "conversations_unread": 0,
        "register_date": 1308798946,
        "last_activity": 1359841741,
        "trophy_points": 28,
        "alerts_unread": 1,
        "avatar_date": 1340917178,
        "avatar_width": 90,
        "avatar_height": 90,
        "gravatar": "",
        "user_state": "valid",
        "is_moderator": 1,
        "is_admin": 1,
        "is_banned": 0,
        "like_count": 47,
        "warning_points": 0,
        "mood_id": 70,
        "friend_count": 0,
        "personal_friend_count": 0
      },
      "user": {
        "user_id": 7252,
        "username": "Jane Doe",
        "gender": "female",
        "gravatar": "",
        "avatar_date": 1359926902
      },
      "new": true,
      "unviewed": true
    }
  },
  "alertHandlers": {
    "XenForo_AlertHandler_User": {
}
}

}


Returns the avatar of user specified by the “value” parameter, if size is not specified or unknown, default (medium) is used instead.

Options for the “size” parameter are:

  • s: Small avatar (48px * 48px)
  • m: Medium avatar (96px * 96px)
  • l: Large avatar (192px * 192px)

NOTE: Only usernames, user ID’s and e-mails can be used for the “value” parameter.

Error Codes:

Error ID Cause of error
1 The “value” parameter was set but empty
1 The “size” parameter was set but empty
3 Neither of the “value” and “hash” parameters were set
4 The “value” parameter is not a registered user

See Error Codes for more information.

Requests:

api.php?action=getAvatar&hash=USERNAME:HASH
api.php?action=getAvatar&size=SIZE&hash=USERNAME:HASH
api.php?action=getAvatar&value=USERNAME&hash=USERNAME:HASH
api.php?action=getAvatar&value=USERNAME&hash=API_KEY
api.php?action=getAvatar&value=USERNAME&size=SIZE&hash=USERNAME:HASH
api.php?action=getAvatar&value=USERNAME&size=SIZE&hash=API_KEY

Examples:

api.php?action=getAvatar&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15dc15b0f00a08
api.php?action=getAvatar&size=M&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getAvatar&value=Contex&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getAvatar&value=Contex&hash=d8e8fca2dc0f896fd7cb4cb0031ba249
api.php?action=getAvatar&value=Contex&size=M&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getAvatar&value=Contex&size=M&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "avatar": "http:\/\/www.xenapi.net\/data\/avatars\/m\/0\/1.jpg?1363566951"
}

Returns any relevant group information about the specified by the “value” parameter.

NOTE: Only group titles, user titles and group ID’s can be used for the “value” parameter.

Error Codes:

Error ID Cause of error
1 The “value” parameter was set but empty
3 Neither of the “value” and “hash” parameters were set
4 The “value” parameter is not a valid group title/group id

See Error Codes for more information.

Requests:

api.php?action=getGroup&value=GROUP_ID&hash=USERNAME:HASH
api.php?action=getGroup&value=GROUP_ID&hash=API_KEY
api.php?action=getGroup&value=GROUP_TITLE&hash=USERNAME:HASH
api.php?action=getGroup&value=GROUP_TITLE&hash=API_KEY

Examples:

api.php?action=getGroup&value=2&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getGroup&value=2&hash=d8e8fca2dc0f896fd7cb4cb0031ba249
api.php?action=getGroup&value=Registered&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getGroup&value=Registered&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "user_group_id": 2,
  "title": "Registered",
  "display_style_priority": 0,
  "username_css": "",
  "user_title": ""
}

Returns any relevant thread information about the specified by the “value” parameter.

NOTE: Only post ID’s can be used for the “value” parameter. Post ID’s can be found by using the ‘getPosts’ action.

Error Codes:

Error ID Cause of error
1 The “value” parameter was set but empty
3 Neither of the “value” and “hash” parameters were set
19 The “value” post could not be found
20 The “value” post was found but the user has no permission to view the post

See Error Codes for more information.

Requests:

api.php?action=getPost&value=POST_ID&hash=USERNAME:HASH
api.php?action=getPost&value=POST_ID&hash=API_KEY

Examples:

api.php?action=getPost&value=1337&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getPost&value=1337&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "post_id": 1337,
  "thread_id": 1778,
  "user_id": 1,
  "username": "Contex",
  "post_date": 1363518242,
  "message": "Post contents",
  "ip_id": 440223,
  "message_state": "visible",
  "attach_count": 0,
  "position": 8,
  "likes": 4,
  "like_users": "a:4:{i:0;a:2:{s:7:\"user_id\";i:3853;s:8:\"username\";s:9:\"ContexTest\";}i:1;a:2:{s:7:\"user_id\";i:3803;s:8:\"username\";s:10:\"ExampleUser1\";}i:2;a:2:{s:7:\"user_id\";i:656;s:8:\"username\";s:12:\"ExampleUser2\";}i:3;a:2:{s:7:\"user_id\";i:5981;s:8:\"username\";s:6:\"ExampleUser3\";}}",
  "warning_id": 0,
  "warning_message": "",
  "node_id": 49,
  "title": "Thread Title",
  "node_title": "Node Title"
}

Returns a list of posts.

NOTE: Permissions come into play if you use user hashes for the request, meaning that posts will skipped if the user does not have permissions to view the thread.
Limit is by default 10, you can change this by using the limit parameter.
Make note that this will also grab the first posts in a thread (position 0).

Error Codes:

Error ID Cause of error
1 The “author” parameter was set but empty
1 The “node_id” parameter was set but empty
1 The “thread_id” parameter was set but empty
4 The “author” parameter is not a registered user
4 Could not find any nodes with the “node_id” parameter
4 Could not find any threads with the “thread_id” parameter
21 The “node_id” parameter was not a number
21 The “thread_id” parameter was not a number

See Error Codes for more information.

Additional Parameters:

order_by:

Allows to order the response by a specific field.

Parameter Value Summary
post_id Post ID.
thread_id Thread ID.
user_id User ID.
username Author username.
attach_count Amount of attachments.
likes Amount of likes.
post_date Post date.
node_id Node ID.
author:

Grabs all the posts made by a specific user.
Valid values are: usernames, user id’s and user emails.

thread_id:

Grabs all the posts by a specific thread ID.
Valid value is only a thread ID.

node_id:

Grabs all the posts by a specific node ID.
Valid value is only a node ID.

See Additional Parameters for more information.

Requests:

api.php?action=getPosts&hash=USERNAME:HASH
api.php?action=getPosts&hash=API_KEY

Examples:

api.php?action=getPosts&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getPosts&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "count": 2,
  "posts": {
    "1": {
      "post_id": 1,
      "thread_id": 1,
      "user_id": 1,
      "username": "Contex",
      "post_date": 1309113432,
      "message": "Post message",
      "ip_id": 336,
      "message_state": "visible",
      "attach_count": 0,
      "position": 0,
      "likes": 0,
      "like_users": "a:0:{}",
      "warning_id": 0,
      "warning_message": "",
      "node_id": 10,
      "title": "Thead title"
    },
    "2": {
      "post_id": 2,
      "thread_id": 2,
      "user_id": 1,
      "username": "Contex",
      "post_date": 1309113527,
      "message": "Post message",
      "ip_id": 337,
      "message_state": "visible",
      "attach_count": 0,
      "position": 0,
      "likes": 0,
      "like_users": "a:0:{}",
      "warning_id": 0,
      "warning_message": "",
      "node_id": 10,
      "title": "Thead title"
    }
  }
}

Returns any relevant resource information about the specified by the “value” parameter.

NOTE: Only resource ID’s can be used for the “value” parameter. Resource ID’s can be found by using the ‘getResources’ action.

Error Codes:

Error ID Cause of error
1 The “value” parameter was set but empty
3 Neither of the “value” and “hash” parameters were set
4 Resource manager was not found

See Error Codes for more information.

Requests:

api.php?action=getResource&value=RESOURCE_ID&hash=USERNAME:HASH
api.php?action=getResource&value=RESOURCE_ID&hash=API_KEY

Examples:

api.php?action=getResource&value=2&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getResource&value=2&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "id": 2,
  "title": "ExampleResource",
  "author_id": 1,
  "author_username": "Contex",
  "state": "visible",
  "creation_date": 1364352654,
  "category_id": 3,
  "version_id": 2,
  "description_id": 2,
  "thread_id": 4601,
  "external_url": "",
  "price": "0.00",
  "currency": "",
  "times_downloaded": 804,
  "times_rated": 1,
  "rating_sum": 5,
  "rating_avg": 5,
  "rating_weighted": 3.1818182468414,
  "times_updated": 0,
  "times_reviewed": 1,
  "last_update": 1364352654
}

Returns all the resources in the resource manager, if author is not specified, default (all) is used instead.

Error Codes:

Error ID Cause of error
1 The “author” parameter was set but empty
3 The “hash” parameter did not have any resources
4 Resource manager was not found

See Error Codes for more information.

Requests:

api.php?action=getResources&hash=USERNAME:HASH
api.php?action=getResources&hash=API_KEY
api.php?action=getResources&author=AUTHOR&hash=USERNAME:HASH
api.php?action=getResources&author=AUTHOR&hash=API_KEY

Examples:

api.php?action=getResources&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getResources&hash=d8e8fca2dc0f896fd7cb4cb0031ba249
api.php?action=getResources&author=Contex&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getResources&author=Contex&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "total": 2,
  "resources": [
    {
      "id": 2,
      "title": "ExampleResource",
      "author_id": 1,
      "author_username": "Contex",
      "state": "visible",
      "creation_date": 1364352654,
      "category_id": 3,
      "version_id": 2,
      "description_id": 2,
      "thread_id": 4601,
      "external_url": "",
      "price": "0.00",
      "currency": "",
      "times_downloaded": 804,
      "times_rated": 1,
      "rating_sum": 5,
      "rating_avg": 5,
      "rating_weighted": 3.1818182468414,
      "times_updated": 0,
      "times_reviewed": 1,
      "last_update": 1364352654
    },
    {
      "id": 5,
      "title": "ExampleResource2",
      "author_id": 2,
      "author_username": "ExampleUser",
      "state": "visible",
      "creation_date": 1364359662,
      "category_id": 2,
      "version_id": 5,
      "description_id": 5,
      "thread_id": 2449,
      "external_url": "",
      "price": "0.00",
      "currency": "",
      "times_downloaded": 54,
      "times_rated": 4,
      "rating_sum": 20,
      "rating_avg": 5,
      "rating_weighted": 3.5714285373688,
      "times_updated": 0,
      "times_reviewed": 3,
      "last_update": 1364359662
    }
  ]
}

Returns a list of general stats items.

NOTE: If user hash is used, some data may be ignored unless the user can bypass user privacy.

Requests:

api.php?action=getStats&hash=USERNAME:HASH
api.php?action=getStats&hash=API_KEY

Examples:

api.php?action=getStats&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getStats&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:
{
  "threads": 1822,
  "posts": 350323,
  "members": 7938,
  "latest_member": {
    "user_id": 7949,
    "username": "Example User"
  },
  "registrations_today": 4,
  "threads_today": 1,
  "posts_today": 484,
  "users_online": 34
}

Returns any relevant thread information about the specified by the “value” parameter.

NOTE: Only thread ID’s can be used for the “value” parameter. Thread ID’s can be found by using the ‘getThreads’ action.

Error Codes:

Error ID Cause of error
1 The “value” parameter was set but empty
3 Neither of the “value” and “hash” parameters were set
19 The “value” thread could not be found
20 The “value” thread was found but the user has no permission to view the thread

See Error Codes for more information.

Requests:

api.php?action=getThread&value=THREAD_ID&hash=USERNAME:HASH
api.php?action=getThread&value=THREAD_ID&hash=API_KEY

Examples:

api.php?action=getThread&value=1337&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getThread&value=1337&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "thread_id": 1337,
  "node_id": 49,
  "title": "Example Title!",
  "reply_count": 30,
  "view_count": 5552,
  "user_id": 1,
  "username": "Contex",
  "post_date": 1364753569,
  "sticky": 1,
  "discussion_state": "visible",
  "discussion_open": 1,
  "discussion_type": "",
  "first_post_id": 311155,
  "first_post_likes": 3,
  "last_post_date": 1367780682,
  "last_post_id": 347382,
  "last_post_user_id": 2,
  "last_post_username": "ContextTest",
  "prefix_id": 0
}

Returns a list of threads.

NOTE: Permissions come into play if you use user hashes for the request, meaning that threads will skipped if the user does not have permissions to view the thread.
Limit is by default 10, you can change this by using the limit parameter.

Error Codes:

Error ID Cause of error
1 The “author” parameter was set but empty
1 The “node_id” parameter was set but empty
4 The “author” parameter is not a registered user
4 Could not find any nodes with the “node_id” parameter
21 The “node_id” parameter was not a number

See Error Codes for more information.

Additional Parameters:

order_by:

Allows to order the response by a specific field.

Parameter Value Summary
title Thread title.
post_date Post date.
view_count Amount of views.
reply_count Amount of replies.
first_post_likes Amount of likes in the first post.
last_post_date Last post date.
author:

Grabs all the threads made by a specific user.
Valid values are: usernames, user id’s and user emails.

node_id:

Grabs all the threads by a specific node ID.
Valid value is only a node ID.

See Additional Parameters for more information.

Requests:

api.php?action=getThreads&hash=USERNAME:HASH
api.php?action=getThreads&hash=API_KEY

Examples:

api.php?action=getThreads&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getThreads&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "count": 2,
  "threads": {
    "1": {
      "thread_id": 1,
      "node_id": 10,
      "title": "Example Title 1",
      "reply_count": 0,
      "view_count": 916,
      "user_id": 2,
      "username": "Contex",
      "post_date": 1309113432,
      "sticky": 0,
      "discussion_state": "visible",
      "discussion_open": 1,
      "discussion_type": "",
      "first_post_id": 1,
      "first_post_likes": 0,
      "last_post_date": 1309113432,
      "last_post_id": 1,
      "last_post_user_id": 2,
      "last_post_username": "ContexTest",
      "prefix_id": 0
    },
    "2": {
      "thread_id": 2,
      "node_id": 10,
      "title": "Example Title 2",
      "reply_count": 0,
      "view_count": 349,
      "user_id": 2,
      "username": "Contex",
      "post_date": 1309113527,
      "sticky": 0,
      "discussion_state": "visible",
      "discussion_open": 1,
      "discussion_type": "",
      "first_post_id": 2,
      "first_post_likes": 0,
      "last_post_date": 1309113527,
      "last_post_id": 2,
      "last_post_user_id": 2,
      "last_post_username": "ContexTest",
      "prefix_id": 0
    }
  }
}

Returns any relevant user information about the specified by the “value” parameter.

NOTE: Only usernames, user ID’s and e-mails can be used for the “value” parameter.
The result varies on the user’s permission level, using an API key bypasses the permission checks.

Error Codes:

Error ID Cause of error
1 The “value” parameter was set but empty
3 Neither of the “value” and “hash” parameters were set
4 The “value” parameter is not a registered user

See Error Codes for more information.

Requests:

api.php?action=getUser&hash=USERNAME:HASH
api.php?action=getUser&value=OTHER_USERNAME&hash=USERNAME:HASH
api.php?action=getUser&value=OTHER_USERNAME&hash=API_KEY
api.php?action=getUser&value=EMAIL&hash=USERNAME:HASH
api.php?action=getUser&value=EMAIL&hash=API_KEY
api.php?action=getUser&value=USER_ID&hash=USERNAME:HASH
api.php?action=getUser&value=USER_ID&hash=API_KEY

Examples:

api.php?action=getUser&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getUser&value=JohnDoe&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getUser&value=JohnDoe&hash=d8e8fca2dc0f896fd7cb4cb0031ba249
api.php?action=getUser&value=[email protected]&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getUser&value=[email protected]&hash=d8e8fca2dc0f896fd7cb4cb0031ba249
api.php?action=getUser&value=1&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getUser&value=1&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

{
  "user_id": 1,
  "username": "Contex",
  "email": "[email protected]",
  "gender": "",
  "custom_title": "",
  "language_id": 1,
  "style_id": 5,
  "timezone": "Europe\/Amsterdam",
  "visible": 1,
  "user_group_id": 3,
  "secondary_group_ids": "2,7",
  "display_style_group_id": 3,
  "permission_combination_id": 63,
  "message_count": 591,
  "conversations_unread": 10,
  "register_date": 1333977020,
  "last_activity": 1366660270,
  "trophy_points": 63,
  "alerts_unread": 4,
  "avatar_date": 1363566951,
  "avatar_width": 192,
  "avatar_height": 192,
  "gravatar": "",
  "user_state": "valid",
  "is_moderator": 1,
  "is_admin": 1,
  "is_banned": 0,
  "like_count": 146,
  "warning_points": 0,
  "mood_id": 20,
  "friend_count": 1,
  "personal_friend_count": 0
}

Returns any relevant user information about the specified by the “value” parameter.

NOTE: Only usernames can be used for the “value” parameter.
Asterisk (*) can be used as a wildcard.

Error Codes:

Error ID Cause of error
1 The “value” parameter was set but empty
3 Neither of the “value” and “hash” parameters were set
4 The “value” parameter is not a registered user

See Error Codes for more information.

Additional Parameters:

order_by:

Allows to order the response by a specific field.

Parameter Value Summary
user_id The ID of the user.
message_count Amount of posts/messagse.
conversations_unread Amount of unread conversations.
register_date Registration date.
last_activity Last activity date.
trophy_points Amount of trophy points.
alerts_unread Amount of unread alerts.
like_count Amount of likes.

See Additional Parameters for more information.

Requests:

api.php?action=getUsers&value=USERNAME&hash=USERNAME:HASH
api.php?action=getUsers&value=USERNAME&hash=API_KEY
api.php?action=getUsers&value=USERN*&hash=USERNAME:HASH
api.php?action=getUsers&value=USERN*&hash=API_KEY
api.php?action=getUsers&value=U*&hash=USERNAME:HASH
api.php?action=getUsers&value=U*&hash=API_KEY

Examples:

api.php?action=getUsers&value=Contex&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getUsers&value=Contex&hash=d8e8fca2dc0f896fd7cb4cb0031ba249
api.php?action=getUsers&value=Cont*&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getUsers&value=Cont*&hash=d8e8fca2dc0f896fd7cb4cb0031ba249
api.php?action=getUsers&value=C*&hash=Contex:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
api.php?action=getUsers&value=C*&hash=d8e8fca2dc0f896fd7cb4cb0031ba249

Response:

[
  {
    "user_id": 1,
    "username": "Contex"
  },
  {
    "user_id": 2,
    "username": "ContexTest"
  }
]

Clone this wiki locally