api

Available methods

This server defines the following API methods:

Authentication

MethodDescription
auth.login Login an existing user and get the user's API token
auth.logout Logout an existing user and remove the user's API token
auth.signup Register a new user and get the user's API token

Users

MethodDescription
users.profile Retrieves a list of tips based on the given filter parameters

Community

Notification

MethodDescription
community.notification.count Retrieves the number of unread notifications for the current API user
community.notification.list Retrieves a list of notifications for the current API user

Subscription

MethodDescription
community.subscription.follow Subscribes the current API user to a given user
community.subscription.unfollow Subscribes the current API user from a given user
community.subscription.followers Retrieves a list of users that are following the current API user
community.subscription.following Retrieves a list of users, the current API user is following

Tips

MethodDescription
tips.tips.list Retrieves the profile information for a specific user
tips.competition Retrieves a list of current competition standings

Authentication

Authentication is based on a username and an API token.
The token is obtained by logging in using username and password and is valid until it is changed or deleted in the user database.

Using the API token

When a token has been obtained it is used for authentication by sending both username and token along as HTTP header fields in all other requests.

The header fields to be used are as follows:

X-Username: <username>
X-Api-Token: <token>

If the user is successfully authenticated, the request is processed and a response is generated and returned, otherwise an error response is returned.

Response types

The data format for the output is determined by the Accept field in the HTTP Headers sent along with the request. Default is application/json.
The responses follow the JSON-RPC formats, which are described here: http://www.jsonrpc.org/specification#response_object. The examples of API responses in this documentation are in the JSON data format and may differ for other data formats.

Success response

The success response object contains the following fields:

{
    "id": <time-based-id>,
    "jsonrpc": "2.0",
    "be-rpc": <api-version>,
    "method": <api-method>,
    "result": <api-result>
}

The id field contains the timestamp of the request time in milliseconds. This can be used in cases where several calls are made asynchronously, to identify which request generated the response.
The jsonrpc field contains the JSON-RPC version used (2.0 for now and the foreseeable future).
The be-rpc field contains the version of the bettingexpert API that responded.
The method field contains the called method, corresponding to the method tables above.
The result field contains the data returned from the API call, encoded in JSON format.

Error response

The error response object contains the following fields:

{
    "id": <time-based-id>,
    "jsonrpc": "2.0",
    "be-rpc": <api-version>,
    "method": <api-method>,
    "error": {
        "code": <error-code>,
        "message": <error-message>
    }
}

The id, jsonrpc, be-rpc, and method fields are used in the same way as in the normal response.
The error field contains a code and a message field containing corresponding values from the table below.
The error field can contain an optional data field containing any data that may be returned from the API call to give more information about the error, encoded in JSON format.

Error codes

The possible error codes are:

CodeMessage
-32300Transport error.
-32400System error.
-32496System error. The API token is expired.
-32497System error. User is blocked.
-32498System error. User needs activation.
-32499System error. Authorisation failed.
-32500Application error.
-32600Server error. Request not conforming to specifications.
-32601Server error. Requested method not found.
-32602Server error. Invalid method parameters.
-32603Server error. Internal error.
-32700Parse error. Not well formed.
-32701Parse error. Unsupported encoding.
-32702Parse error. Invalid character for encoding.