CoreData API
Contents
CoreData API version 2
For endpoints' details and usage examples seeAPI v2.
Swagger
Here is a Swagger page for API v2: https://mmg.coredata.is/api/v2/doc/.
OpenAPI
API v2 also has a draft (unfinished) OpenAPI schema, which can be seen at https://mmg.coredata.is/api/v2/openapi.yaml. One can explore the OpenAPI schema using an online editor https://editor-next.swagger.io/ by opening the editor and selecting menu “File / Import URL” and providing the schema URL.
CoreData API version 3
For endpoints' details and usage examples see API v3.
API v3 does not have a Swagger page.
General information
Some general information about CoreData API and this documentation can be found below.
Trailing slash
When making an API call with a test client, make sure a trailing slash is present in the URL. If it isn't, the server will respond with a redirect, which the client could try to access with GET
method instead of possibly different one in the initial request.
Example API requests & responses
The documentation contains examples of CoreData API requests and their responses. The examples may contain some placeholders in the following format:
$SOME_VARIABLE
– means value of the variableSOME_VARIABLE
(a variable either environment or another type depending on the context);<SOME_VARIABLE>
– means a placeholder referencing some variable defined in the example context earlier.
API examples use curl
command line tool to send requests. The examples operate environment variables. Some of them are declared explicitly in the examples. Some variables are assumed to be declared beforehand in order not to duplicate the same code code for all examples, such cases are variables for authentication, see API v2 authentication and API v3 authentication below for details, and the CoreData base URL COREDATA_BASE_URL
.
API v2 authentication
API v2 examples assume that the following environment variables are set:
API_USER
– username for API authentication;API_KEY
– API key belonging to the user (see Create API key for more details below).
By default the examples use apikey
authentication method which sends Authorization
header in the following format:
Authroization: apikey $API_USER:$API_KEY
API v3 authentication
API v3 examples assume that the following environment variable is set:
API_KEY
– API key belonging to the user (see Create API key for more details below).
By default the examples use apikey
authentication method which sends Authorization
header in the following format:
Authroization: apikey $API_KEY
Basic authentication
Some of the API endpoints also supports basic authentication, then the Authorization
header should be sent in the following format:
Authorization: Basic base64($API_USER:$API_PASSWORD)
Where:
API_USER
– authentication user;API_PASSWORD
– the user’s password;base64()
– a function call accepting a string and returning its base64 encoded representation.
Create API key
An API key belongs to a user and allows for the user to access CoreData API.
In CoreAdmin when editing an existing user or creating a one there is “API key” field holding an existing API key and allowing to renew or create a new one:
The pair of username and their API key can be used to authorise CoreData API calls.