To ensure secure access to the IS Macro Engine API, we employ token-based authentication. Follow these steps to authenticate and start using the API:
-
Obtaining Your Access Token:
Send a
POST
request to/api/auth/token
with your username and password as form data.The request format should be as follows:
POST /api/auth/token Content-Type: application/x-www-form-urlencoded username=YOUR_USERNAME&password=YOUR_PASSWORD
Upon successful authentication, the server will respond with a JSON object containing your
access_token
and the token type (typically "bearer"). -
Using Your Access Token:
To access protected routes, include this token in the
Authorization
header of your HTTP requests.The header should be formatted as follows:
Authorization: Bearer YOUR_ACCESS_TOKEN
This token is required for all API requests that need authentication.
-
Token Expiry:
Note that tokens are valid for a limited time (30 minutes by default). After the token expires, you will need to authenticate again to receive a new token.
-
Example of an Authenticated Request:
Here's how you can make an authenticated request to a sample endpoint
/api/resources
:GET /api/resources Authorization: Bearer YOUR_ACCESS_TOKEN
-
Handling Authentication Errors:
If you encounter a
401 Unauthorized
error, ensure your username and password are correct and that your token has not expired.For continued difficulties, contact our support team for assistance.