Authentication
Authentication is accomplished by two methods. Cookie token or user/password.
Cookie Token
Form fields username and pw can be sent to any AoB non-API and non-static endpoint (you can just use the root endpoint “/” for simplicity) and a session cookie will be returned. This cookie can be used in API calls just as a browser would for authentication.
User/Password
If you choose to not use the Cookie Token method, send the account username and password in the header fields “AOB-AUTH-USER” and “AOB-AUTH-PW” respectively. As you might imagine, this will send the username and password in cleartext so using a secure connection (https) is recommended.
Endpoints
The AoB API functions by REST endpoints using GET, PUT, POST, and DELETE commands. The base of all endpoints is:
http(s)://www.theartofbooks.com/api/2.0/
Description Format
Each API entry will be formatted like this:
Endpoint
GET/this_is_the_endpoint
Description
Short description of the intent of this API call
Input
List and description of expected input content. This would be for things like upload files and the like that would otherwise not fit properly in the Variables section.
Variables
List and description of expected variables.
Any variables can also be sent in a variable “p” consisting of a Base64 encoded JSON hash string. For example, if you wanted to send the variables sku=’1234′ and venue=’amz’ in this way you might send something like this:
https://www.theartofbooks.com/api/2.0/<endpoint>?p=eyAic2t1IjogIjEyMzQiLCAidmVudWUiOiAiYW16IiB9
eyAic2t1IjogIjEyMzQiLCAidmVudWUiOiAiYW16IiB9 decodes to:
{ "sku": "1234", "venue": "amz" }
Output
Explanation of output format.
Most calls output a JSON string of the following format:
{ results: <results hash>,
errors: { "errors" : { error_code: <numeric error code>,
error_text: <short description of error> }
}
}
Multi-User access is not implemented at this time. For these accounts, the User/Password option is unavailable and the Cookie Token must be associated with the “default” user.
Pagination is not implemented on all calls. Whether or not pagination is implemented for a call will be noted in the documentation for that call. If you have a large data set that will return you will want to keep this in mind. To use pagination, simply add two variables page with which page number you’d like returned and num_per_page for how many items per page should be used to your call.
Comments