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:

  1. Click Avatar on navigation bar API Key
  2. Choose ENABLE API ACCESS if you haven't enable API access before
  3. 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:

https://otbzone.com/bot/api/ver-1

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.

Product Type APIs

OTB Fulfillment has a list of Product Types. Product Types are a way to group similar products together, including product variants such as size, color, etc.

You can use API to get a list of all Product Types.

Get All Product Types

GET /product-types


Product APIs

The Products API resource lets you create, modify and delete products in a OTB Fulfillment store based on the Manual orders / API platform (you can create such store by going to the Stores section at your OTB Fulfillment dashboard.)

Each product will contain different variants (including Name, SKU, Product Type, Print Design, Price, etc)

Get All Products

GET /products or GET /products?page=1&pageSize=20
Note: page default is 1 and pageSize default is 20


Get Product By Id

GET /products/{id}


Create New Product

POST /products


Update Product By Id

PUT /products/{id}


Order APIs

The Orders API is the most important part of the OTB API.

It allows you to create new orders, update orders and confirm them for fulfillment.

Get All Orders

GET /orders or GET /orders?page=1&pageSize=20
Note: page default is 1 and pageSize default is 20


Get Order By Id

GET /orders/{id}


Create New Order

POST /orders


Update Order By Id

PUT /orders/{id}


Estimate order price

POST /estimate-order-price


Create An Instant Order

POST /instant-order


Order Item APIs

The Order Item API allows viewing of the order items that a user has placed.

Each order item belongs to one order.

Get All Order Items

GET /order-items or GET /order-items?page=1&pageSize=20
Note: page default is 1 and pageSize default is 20


Transaction APIs

Transaction API allows users to deposit, withdraw, view current balance and other functions that related to transactions.

You can use this API to get functions that relate to Transaction.

Get Current Balance

GET /balance