IntroductionLast updated: 12/02/2021
The OTB Fulfillment API is a RESTful API, that uses a HTTP protocol for communication. HTTP GET, POST, PUT, PATCH and DELETE methods are used to access the API.
How to start
To begin using OTB Fulfillment API, follow these steps:
- Click Avatar on navigation bar
API Key - Choose ENABLE API ACCESS if you haven't enable API access before
- Click button to copy your unique API Key
API Key
The API Key is a secret key and unique to each user, which is used to access the API. You can enable the API and generate an API Key for your account by following these steps above How to start
You might want to copy your key and keep it secure. Do not expose it anywhere
Authentication
OTB Fulfillment uses HTTP authentication for the API requests.
To perform authorization, you need to add the Authorization
header with API key to request:
Request endpoint
All API requests have to be sent to this URL:
If you are using a proxy, make sure that all requests have host header set to otbzone.com/bot/api/ver-1
Request parameters
Some mandatory parameters (like object identifiers) must be included in the request URL path:
GET /orders/60338dfc95318394612164e7
Additional parameters can be passed as GET variables:
GET /orders?page=1&pageSize=20
Status Response Codes
We use standard HTTP codes to denote successful execution or indicate when errors occur. For some errors, the response will include additional information about the error, including an application error code and human readable error description.
Successful execution
Operations that execute successfully will return 2xx codes, and, where appropriate, will return the information requested directly in the response body. The table below shows the typical response codes:
| Method | HTTP code | HTTP Description | Notes |
|---|---|---|---|
| GET | 200 | OK | For successful GET and PUT requests. |
| POST | 201 | Created | For a successful POST request will result in a new entity, e.g. placing an order |
| POST | 204 | No Content | For a successful request that produced no response (such as DELETE requests). |
Error Handling
Operations that result in an error due to a problem on the client's part (eg invalid input) will be standard 4xx codes. Operations that result in an error due to a problem in the Rev server will return 5xx codes.
Where a standard HTTP error is sufficiently descriptive, e.g. 401 (Not Authorized) or 404 (Not Found), the response body will be empty. For other cases, we will use the generic response code for client error (400), and the response will include an error entity that gives further details about the error, including an application error code and a human readable error description.
| HTTP code | HTTP Description | Notes |
|---|---|---|
| 400 | Bad Request | Issued when a malformed request was sent. |
| 401 | Unauthorized | This response is sent when your client failed to provide credentials or its credentials were invalid. |
| 403 | Forbidden | Returned when permissions do not allow the operation. |
| 404 | Not Found | When a particular resource doesn’t exist or couldn’t be found. |
| 422 | Missing or Invalid Data | The request cannot be processed either because it omitted required fields or because it contained invalid data. See the response for more details. |
| 429 | Too Many Requests | When an OAuth client exceeds the rate limit for API requests to a store. |
| 500 | Internal Server Error | When an error has occurred within the API. |
| 503 | Service Unavailable | When the store is “Down for Maintenance,” being upgraded to a new version, or is suspended due to administrative action. |
Response body
The response body is always a JSON object that contain a response status boolean and the result of the action. If the status is true, then the action will be successful.
{
"status": true, // Response status
"message": "Succeed",
"data": {
// API method response data
}
}
Sometimes the response includes paging information to allow browsing larger result set by adding
page and pageSize GET parameters to the URL request.
{
"status": true, // Response status
"message": "Succeed",
"data": {
"data": [
{
// API method response data
}
],
"total": 6 // Total number of records
}
}
Error response
If the API call is not successful, then the response status will be return false and the message attribute contains an error description.
{
"status": false, // Response status
"message": "No token provided!",
"data": {
// API method response error data
}
}
Timestamps
All timestamps from the API are returned as integers in UNIX timestamp format
Rate limits
OTB Fulfillment API has a general rate limit of 120 API calls per minute. Additionally, endpoints that perform resource intensive operations (such as mockup generator) have a lower allowed request limit.