# API Specifications
## Overview
This document outlines the specifications for the ATLAS ETRM API, providing guidance on authentication, rate limiting, endpoints, and response formats. This API is designed for third-party applications to be easily integrated with the ATLAS ETRM.
Please find additional examples for the ATLAS ETRM API to Please find additional examples for the ATLAS ETRM API to the API Examples Postman collection.
## Authentication
### SSL Certificates
All connections to the API must be secured using SSL certificates to ensure data integrity and privacy between the client and the server. Clients are required to connect using HTTPS protocol to prevent man-in-the-middle attacks.
### Bearer Token Authentication
Access to the API is granted through Bearer Token Authentication. Clients must provide a valid, unexpired access token in the request header.
<br>
<u>Tokens are valid for 1 hour</u>.
Tokens can be obtained through the following endpoint:
- POST /api/token
- Description: Authenticate the user and retrieve an access token.
- Parameters: Username and password are passed via Basic Auth.
- Response:
- 200 OK - Successfully authenticated
- 401 Unauthorized - Authentication failed
## Rate Limiting
To ensure fair usage and protect the API from abuse, the API is rate-limited as follows:
Requests: 100 requests per minute per client.<br>
Exceeding Limits: Exceeding this limit results in a 429 Too Many Requests response until the limit resets.
## Data Formats
Responses from the API are provided in JSON format. Ensure that your client parses the response accordingly.
## Error Handling
The API utilizes standard HTTP response codes, as defined in RFC 2616 and RFC 6585, to indicate the success or failure of an API request. Here is a detailed list of potential status codes and their meanings:
### Response Status Codes
200 OK - The request has succeeded. The client can read the result of the request in both the body and the headers of the response.<br>
201 Created - The request has been fulfilled, resulting in the creation of a new resource.<br>
202 Accepted - The request has been accepted for processing, but the processing has not yet been completed.<br>
204 No Content - The request has succeeded but does not return any content in the message body.<br>
### Client Error Responses
400 Bad Request - The server cannot process the request due to a client error (e.g., malformed request syntax). Additional details will be provided in the message body.<br>
401 Unauthorized - Authentication is required and has failed or has not been provided. Further details may be available in the message body.<br>
403 Forbidden - The server understood the request but refused to authorize it.<br>
404 Not Found - The requested resource was not found. This may be due to a temporary or permanent removal of the resource.<br>
429 Too Many Requests - The request was not accepted due to rate limiting. The client should reduce the frequency of requests.<br>
### Server Error Responses
500 Internal Server Error - The server encountered an unexpected condition that prevented it from fulfilling the request. This error is usually a server-side issue.<br>
502 Bad Gateway - The server was acting as a gateway or proxy and received an invalid response from the upstream server.<br>
503 Service Unavailable - The server is currently unable to handle the request due to a temporary overload or maintenance. The client may repeat the request after a delay.<br>
AuthorizationJWT Authorization header using the Bearer scheme. Enter your token including the 'Bearer ' prefix (e.g. 'Bearer eyJ...').
AuthorizationBasic authentication. Credentials are Base64-encoded username:password sent in the Authorization header.