The Ankeri API provides access to big part of the data entered into Ankeri. Access to the API is configurable for each user and is not enabled by default. Access for individual users to the Ankeri API can be configured on the Users settings page.
Endpoints
The Ankeri API includes a Swagger documentation that includes information on the resources of the API, with examples of inputs and outputs for each method. Note that each endpoint is explained in detail at Models part that is expandable at the bottom of the Swagger documentation. Additional information about endpoints is also given as a part of this documentation.
Authentication
Authentication to the API is done with a JSON Web Token (JWT) that needs to be included in the header of each request (except for login) to the API. The login resource provides the JWT, with the Ankeri username and password as inputs and the token and expiry date (24 hours valid time) as outputs.
Note that if the API usage is intended for regular automated requests, it is suggested to create a dedicate Ankeri user for that task instead of relying on an user account that belongs to an employee.
Units
Measurement units are listed in the input and output models for the API, given in the Swagger documentation.
Evaluation dates
Some endpoints offer the user to input evaluation date if historical values are to be inspected. Note that the evalDate accepts various formats but should always have date first, for example:
DD.MM.YYYY HH:MM:SS
where the time part is optional. Other formats such as DD-MM-YYYY, D-M-YYYY and D.M.YYYY can also be used.
Handling of empty values
Empty values, for example for properties, are generally give as null values (property with null value is not omitted). This applies to strings and integers (types are given in Swagger documentation). For arrays, an empty value is indicated with an empty array.
Troubleshooting
Email used as login needs to be confirmed
Related articles
Python examples
The following example illustrate how make a post request to the login resource.
# Import packages import requests # Payload for request payload = {'email':'username@shipppingcompany.com', 'password':'mypassword'} # Make request
url = 'https://platform.ankeri.net/api/v1/login' r = requests.post(url=url, json=payload) # Extract token and its expiry date from json data data = r.json() token = data['token'] exp = data['exp']
The following example illustrate how make a get request to the ships resource.
# Import packages import requests
# Make request
url = 'https://platform.ankeri.net/api/v1/ships' r = requests.get(url, headers={'Authorization':token})
# Extract data to json format data = r.json()