Introduction
This feature is currently available in Enapter Cloud and Enapter Gateway with firmware version 2.1 and above.
API activation may be needed in Enapter Cloud. Please reach out to our developers support at developers@enapter.com.
API Base URL
Use the following base URLs to access this API:
- Enapter Cloud:
https://api.enapter.com/
- Enapter Gateway:
http://enapter-gateway.local/api/
Authentication
Enapter HTTP API uses API tokens to authenticate requests. The token must be provided for every API request via custom HTTP header X-Enapter-Auth-Token
:
$ curl http://enapter-gateway.local/api/assets/v1/devices -X GET \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}'
$ curl https://api.enapter.com/assets/v1/devices -X GET \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}'
Errors
Enapter uses conventional HTTP response codes to indicate success or failure of an API request. Codes in the 2xx
range indicate success. Codes in the 4xx
range indicate request payload errors. Codes in the 5xx
range indicate Enapter servers' errors.
HTTP Status Code | Explanation |
---|---|
200 — OK | Everything worked as expected. |
400 — Bad Request | The request payload has failed parsing or validation. |
403 — Forbidden | Authentication token is invalid, missing or expired. |
404 — Not Found | A non-existent resource is requested. |
422 — Unprocessable Entity | Unable to process the contained instructions. |
429 — Too Many Requests | Too many requests hit the API too quickly. |
500 — Internal Server Error | Something went wrong on Enapter's end. |
Common Error Format
code
stringrequired#A short string indicating the reported error code.
message
stringrequired#A human-readable message that provides more details about the error.
details
object#Additional error-specific fields.
{
"code": "invalid_header",
"message": "Authentication token is invalid.",
"details": {
"header": "X-Enapter-Auth-Token"
}
}