API Structure

About OPT OnDemand API

The OPT OnDemand API is a RESTful API that utilizes the HTTP protocol for communication and adheres to the OpenAPI specification. The API supports the GET, POST, PUT, and DELETE methods for accessing its resources.

Requests

Request endpoint

All API requests have to be sent to this URL.

https://api.optondemand.com/

Request parameters

Some mandatory parameters (like object identifiers) must be included in the request URL path.

GET /orders/433564 

Additional parameters can be passed as GET variables.

GET /orders?page=2&limit=25

For POST and PUT requests, a more complex data structure can be passed as JSON in the request body.

POST /orders {
    "orderId":"433564", 
    "shipping":{...}, 
    "items":[...]
}

Responses

Response body

The response body is always a JSON object. If the status code is 200, then the action was successful.

{
  "totalItems": 1,
  "data": {
    "ean13": "34546267",
    "name": "Amazing Superman T-shirt Black S",
    "stockLevelQuantity": 1
  }
}

Error response

If the API call is not successful, then the response code is not in the 2xx range and the error attribute contains an error description.

{
  "error": "Order Not Found",
  "message": "No order exists with the provided orderId."
}

Last updated