The Kontainer API provides an easy integration of your existing software into the Kontainer platform. This software-to-software interface allows your applications to exchange data with Kontainer and can be used to automate many different processes.
In the following, we will go through the basics of the API setup.
The information in this article is technical and targeted at developers in charge of API setup. If you have any questions, feel free to let us know.
API Code
Get straight to the code for API integration HERE.
NOTE that you need to use your unique Kontainer URL instead of the one in the example in the above-listed links (“api.kontainer.com”).
Want to Skip Ahead?
Getting Started
In order to use Kontainer API, you’ll need an account with Kontainer, as well as an API access token.
Please contact your local administrator or Kontainer Support for additional information on how to get access to the Kontainer API.
Authentication
The Kontainer API utilizes OAuth for authentication. Once you’ve been given an API access token, you must provide this token in each request via the Authorization header as a “Bearer” value.
All requests must include your provided API access token in the Authorization header: Authorization: Bearer {{access-token}}
Content Negotiation
All requests must include the header: Accept: application/vnd.api+json
.
Requests sending JSON data must include the header: Content-Type: application/vnd.api+json
JSON:API Standard
The Kontainer API is RESTful API following the JSON API standard. You can refer to this standard for more information on how the request and response documents are structured.
Rate Limits
The standard API rate limits apply to all endpoints we provide, and the limit is 500
requests per minute. Exceeding the defined rate limit will result in API responding with the response message: 429: Too Many Attempts
.
Response Codes
The Kontainer API responds with HTTP status codes and JSON-based error codes and messages.
HTTP Status Codes
The following table gives an overview of HTTP status codes that are returned.
HTTP Status Code | Text | Description |
---|---|---|
200 | OK | Success. |
201 | Created | Object created. |
204 | No Content | No content returned. |
401 | Unauthorized | Token is missing or invalid. |
403 | Forbidden | Resource or Request not supported |
404 | Not Found | Object not found. |
406 | Not Acceptable | Request not acceptable |
409 | Conflict | Application or resource state conflict. |
422 | Validation Error | Validation error occurred. |
429 | Too Many Requests | Rate limit exceeded. |
Error Messages
The following example illustrates how an error messages will looks like for HTTP status code 401 - Unauthorized
.
Filters
Filters can be applied to supported endpoints to limit the results that are returned. Filters are applied by using the filter
query parameter. You can find the filter fields that are supported in the Filter Attributes section of each endpoint.
Examples:
Get a list of Category Items/Products:
filter[description][like]
: Shoes
Find items by exact EAN:
filter[ean][eq]
: 4194382028137
Find items after a certain date:
filter[released_on][gt]
: 2020-01-01
Find items with unit cost greater or equal to 22.50, and less than 50.00:
filter[unit_cost][gte]
: 22.50
filter[unit_cost][lt]
: 50.00
Filter Qualifiers
- Equals: [eq]
- In: [in]
- Like: [like]
- Greater than: [gt]
- Greater than or equal: [gte]
- Less than: [lt]
- Less than or equal: [lte]
- Not In: [notin]
Note: The allowed filter qualifiers depend on the element being searched.
Compound Documents
To reduce the number of HTTP requests, responses on supported endpoints may be requested to “include” related resources along with the requested primary resources. Included resources are requested by using the include
query parameter. You can find the supported includes in the Available Includes section of each endpoint.
Examples:
- In the GET /elements endpoint, to include the associated Element Options:
include: element_option
- In the GET /items endppoint, to include the root, parent, and child items:
include: parent_item,root_item,children
API Code
Get straight to the code for API integration HERE.
NOTE that you need to use your unique Kontainer URL instead of the one in the example in the above-listed links (“api.kontainer.com”).