The Kodmyran Commerce platform provides several very different APIs, firstly the old SOAP API is still available but deprecated; secondly a range of new JSON/REST based APIs enables access to all parts of the platform without restrictions; and thirdly the JSON headless API provides a complete headless implementation. All APIs except the SOAP API are described in this documentation.
You can find the obsolete documentation for the SOAP API here:
Please note that all APIs except the headless one execute in the superuser mode of Kodmyran Commerce (within the context of the adminuser the API key belongs to), whereas the headless API execute in user mode within the context of a particular end-user.
All API endpoints with the exception of the headless API are presented as OpenAPI/Swagger compatible services and are fully described by the swagger.json or openapi.json files.
Tools such as Postman, SwaggerUI, SoapUI, ReadyAPI etc. can easily be used for simulation and testing.
All strings are to be sent as UTF-8 per JSON standards.
You can access the swagger.json file for integration with various tools at:
https://testaccount.kodmyran.io/admin/api/swagger.json
Or if using the newer OpenAPI specification:
https://testaccount.kodmyran.io/admin/api/openapi.json
Replace testaccount with your own domain provided when your account was setup.
You can also access an HTML based browser of the API through this link:
https://testaccount.kodmyran.io/admin/api/openapi.html
Note that this page is huge and can easily crash web browsers with out of memory errors on loaded systems.
A single call to the JSON API is fully transactional, a failure during processing will result in a database rollback of all data changed during that call. The API may in certain cases store individual updates and re-apply these after a rollback. This is intended to be used for call tracking/tracing only and not for normal operation and is invisible to API users.
All the end-points are regulated by an API call limit/minute, except the headless API. This limit is global for the entire account and is applied to all calls that can be authenticated. Calls that terminate prior to authentication are not included in the limit (e.g. fetching swagger.json or issuing some OPTION commands over HTTP).
Every account is allowed a minimum allowance of 20 calls/minute free of charge. Additional capacity is sold as a separate license in batches of 250 calls/minute, and batches can be stacked to reach a considerably higher limit. Contact Kodmyran for more information if the included allowance is too low for your integration.
To let you keep track of your consumption two headers are returned with each authenticated response:
| Header | Description |
|---|---|
| X-Commerce-APILimit | The upper limit of calls permitted per interval |
| X-Commerce-RemainingAPILimit | The number of calls remaining in the current interval, e.g. this minute |
Use these headers to pace your integration rather than waiting to be throttled; a well behaved consumer slows down as the remaining count approaches zero.
A call that exceeds the limit is rejected with a HTTP 429 response. The response does not include a Retry-After header, so base your backoff on the two headers above and on the length of the interval.
Kodmyran Commerce takes security very seriously and requires authentication of all calls, the use of HTTPS and provides several consistency checks to prevent misuse.
All APIs except the headless requires all requests to be authenticated using one of the below four methods:
Passing initial authentication is not sufficient by itself, you also need to communicate using HTTPS, and must be sending your queries to the account domain, not the user domain. Hence you cannot call either https://www.myshop.com/admin/api or http://www.myshop.com/admin/api. All requests must be directed to https://<account>.kodmyran.io/admin/api - where account is replaced by your eight-character account name.
An account name, and the <account>.kodmyran.io domain derived from it, is never reassigned to another account. Once issued it belongs to that account permanently, which makes it safe to use as a stable identifier for a publishing destination in your own system.
Once the key has been validated, and the domain name checked, the user associated with the API key is checked for proper permissions. Initially the user must possess the "Remote call: Read" and/or the "Remote call: Write" permissions (depending upon the HTTP request verb).
Once the user passes this check the role that they possess must also contain permissions to access the requested entity type. The permissions granted to that role for that object type dictates the users access. The available permissions are:
The headless API requires the use of an API key to permit requests. This API key is unrelated to the API key used for the other APIs, it is an application unique string that must be provided in each call in the X-API-Key HTTP header.
To create the API key to use for the headless API you need to use the SOAP API first, and use the registerApplication call which will return an application ID/key in return. The headless API can only be used server-to-server and will not allow direct access using Javascript from a clients browser.
Kodmyran Commerce has support for a wide variety of synchronization patterns, here are some common ways of synchronizing. The first four items are used with the entity API, the fifth option is strictly for the integration API.
All requests hitting Kodmyran Commerce that carry a body must declare the proper content-type, and the value is expected to describe the body you are actually sending.
For every API except the media API the body is a JSON document, and the content-type must be set to application/json.
The media API is the exception. Since the body of an upload is the file itself, the content-type must be the media type of that file, e.g. image/jpeg for a JPEG image or application/pdf for a PDF document. The accepted media types are listed in the documentation for that API.
A character encoding may be appended to the value, e.g. application/json; charset=utf-8. The encoding part is ignored; all textual content is expected to be UTF-8 regardless.
Requests that carry no body, such as GET and DELETE, do not need a content-type header at all.
A content-type that the platform does not recognise is rejected with a bad content-type error before the call is processed.