API Token Tutorial¶
As with most service providers, we want to expose our system to allow customers to export and import data from our system using automation and interfacing other API’s. To use our system via API, we have a simple integration setup.
Steps to getting an API Key¶
- (Optional) Create a ‘Service-User’ user
- (Optional) Test Service-User login
- Get a persistent API Key via the /api_tokens/ endpoint of our system
- Enter the persistent API in the system connecting to our API’s
(Optional) Create a ‘Service-User’ user¶
You get an API key for an individual user, but we strongly suggest creating a ‘Service-User’ in the system for each integration, to track access and changes by automated systems. This can be done via your own Authentise Admin, or one of our customer support agents.
We require a unique email for this, often we have customers use 'service-X@customer.com‘ email, or sometimes use the + syntax to notify the right person on events. Such as 'serviceXemail@example.com‘.
This is a user to represent your automation’s input into the session. Often these are named by the ‘Service’ with email of 'service_name@your_company.com‘
(Optional) Test Service-User login¶
If you do create a Service-User, we strongly recommend doing a quick general log-on to the system, to make sure no typos or errors were made in the setup.
Get a persistent API Key via the /api_tokens/ endpoint¶
Using the verified account, you can now access and save an API key, to use for long-term access to our API. If you want a pre-built example of getting an API Token for use in your API.
Enter the persistent API in the system connecting to our API’s¶
This depends on your system, but the quickest way to connect to the system would be use use HTTP standard Basic Auth to the API Key as your access token to the Authentise Service.
def make_request(self, url, data): "Example of calling the API using the API Key to request data from an endpoint" auth = HTTPBasicAuth(self.api_auth["uuid"], self.api_auth["secret"]) return requests.post(url.format(self.host), auth=auth, data=data, verify=self.verify_ssl)