Olyn API Errors
Learn how Olyn handles errors in the API.
Introduction
Olyn uses conventional HTTP response codes to indicate the success or failure of an API request.
Olyn API HTTP Response status codes:
- Codes in the
2xx
range indicate success. - Codes in the
4xx
range indicate an error that failed given the information provided (e.g., a required parameter was omitted). - Codes in the
5xx
range indicate an error with Olyn's servers.
Some 4xx
errors that could be handled programmatically include an error code that briefly explains the error reported. Developers could handle these types of errors programmatically.
HTTP Status Code Summary
The Olyn API has a defined set of possible Status codes to return depending on the Request execution. Here's a detailed list of all possible responses a developer can expect from the Olyn API
Response Status Code | Description |
---|---|
200 - OK | The request has been acknowledged and fully processed correctly. |
201 - CREATED | The request has been acknowledged and fully processed correctly, creating a new resource. |
204 - NO CONTENT | The request has been acknowledged and fully processed correctly, currently used only in the /health endpoint. |
400 - BAD REQUEST | The request has been acknowledged and partially processed, often due a missing or bad parameter in the request. |
401 - UNAUTHORIZED | The request has been acknowledged and partially processed due an invalid API Key has been provided. |
402 - REQUEST FAILED | The request has been acknowledged and partially processed, due to the request was valid, but the connection was dropped. |
403 - FORBIDDEN | The request has been acknowledged and partially processed, due to the developer does not have permission to perform the specific request. |
404 - NOT FOUND | The request has been acknowledged and partially processed, due to the requested resource does not exist. |
405 - METHOD NOT ALLOWED | The request has been acknowledged and partially processed, due to the verb provided in the API request is not valid. |
409 - CONFLICT | The request has been acknowledged and partially processed, due to colliding resources with the same identifier. |
429 - TOO MANY REQUESTS | The request has been acknowledged and partially processed, due to the rate limit having exceeded the defined threshold. |
500 - INTERNAL SERVER ERROR | The request has not been acknowledged and partially processed due to an internal Olyn error. |
502, 503, 504 - SERVER ERRORS | The request has not been acknowledged nor processed. |
Error Types
The Olyn API will provide a flag message in the body of the API response, its purpose is to provide a brief message of the error that happened inside the API, as some errors can happen in the process of sending the request to the API.
Error Types | Description |
---|---|
INVALID_REQUEST_ERROR | Invalid request errors arise when your request has invalid parameters. |
AUTHENTICATION_ERROR | Failure to properly authenticate to complete the request. This could be due to a bad API key, invalid Organization code, or a lack of the proper roles needed to interact with the endpoint. |
FORBIDDEN | Forbidden method type when accessing resources |
NOT_FOUND | Not Found errors arise when your resource does not exist. |
METHOD_NOT_ALLOWED | Method not available for the caller, usually indicates that the service is not ready for that resource |
CONFLICT | Conflict errors arise when a request conflicts with the current state of the target resource. |
API_ERROR | API errors cover any other type of problem (e.g., a temporary problem with Olyn's servers). |
Error Codes
The Olyn API provides a descriptive error message for each error, detailing in most cases what was the cause of the issue. (e.g missing a parameter in the request, X resource not found, etc...)
# Standard Error Codes
# Invalid request errors arise when your request has invalid parameters.
INVALID_REQUEST_ERROR = "INVALID_REQUEST_ERROR"
# Forbidden Error
FORBIDDEN = "FORBIDDEN"
# Bad Request Code Error raise
BAD_REQUEST = "BAD_REQUEST"
# Not Found errors arise when your resource does not exist.
NOT_FOUND = "RESOURCE_NOT_FOUND"
# Conflict errors indicates a request conflict with
# current state of the target resource.
CONFLICT = "CONFLICT_WITH_TARGET_RESOURCE"
# Accessing an endpoint with a wrong Method verb.
METHOD_NOT_ALLOWED = "METHOD_NOT_ALLOWED"
# Specific Olyn API Errors
# Generic invalid ID
INVALID_ID = "INVALID_ID"
# The owner is in an invalid format.
OWNER_INVALID = "OWNER_INVALID"
# No delivery method specified
NO_DELIVERY_METHOD_PROVIDED = "NO_DELIVERY_METHOD_PROVIDED"
# Metadata resource not found in DB
METADATA_NOT_FOUND = "METADATA_NOT_FOUND"
# Metadata Type not supported
METADATA_TYPE_NOT_SUPPORTED = "METADATA_TYPE_NOT_SUPPORTED"
# Metadata Key already exists
METADATA_KEY_ALREADY_EXISTS = "METADATA_KEY_ALREADY_EXISTS"
# Invalid Payload Missing Fields
MISSING_REQUIRED_FIELDS = "MISSING_REQUIRED_FIELDS"
# Generic Validation Error
VALIDATION_ERROR = "REQUEST_VALIDATION_ERROR"
# Invalid Transaction Type
INVALID_TRANSACTION_TYPE = "TRANSACTION_TYPE_NOT_SUPPORTED"
# Invalid Transaction Payload
INVALID_TRANSACTION_PAYLOAD = "INVALID_TRANSACTION_PAYLOAD"
# Invalid PublicKey
PUBLIC_KEY_INVALID = "PUBLIC_KEY_INVALID"
# Blockchain Transaction not found
TRANSACTION_NOT_FOUND = "TRANSACTION_NOT_FOUND"
# Transaction checks failed
TRANSACTION_CHECKS_FAILED = "TRANSACTION_CHECKS_FAILED"
# Status for unit card registry not supported
CARD_STATUS_NOT_SUPPORTED = "STATUS_FOR_CARD_NOT_SUPPORTED"
# Card Type not supported
CARD_TYPE_NOT_SUPPORTED = "CARD_TYPE_NOT_SUPPORTED"
# Blockchain currently not supported
CHAIN_NOT_SUPPORTED = "BLOCKCHAIN_NOT_SUPPORTED"
# URL NOT FOUND IN SERVER
URL_NOT_FOUND = "THE_REQUESTED_URL_WAS_NOT_FOUND_ON_THE_SERVER"
# Key not found
KEY_NOT_FOUND = "KEY_NOT_FOUND"
# Asset Type not valid
ASSET_TYPE_NOT_VALID = "ASSET_TYPE_NOT_VALID"
# Raised when trying to access a resource and unauthorized request is done
MISSING_OWNER_SIGNATURE = "MISSING_OWNER_SIGNATURE"
# Trying to use / update an incorrect status
STATUS_NOT_ALLOWED = "STATUS_NOT_ALLOWED"
# Trying to set the current status as a new one.
STATUS_ALREADY_SET = "STATUS_ALREADY_SET"
Sample Error Responses
Authentication Error:
{"error": {"type": "AUTHENTICATION_ERROR"}}
Key Not Found Error:
{"error": {"type": "NOT_FOUND","code": "KEY_NOT_FOUND"}}
Updated 10 months ago
Learn how Olyn communicated and defines versions in order for developers to keep services up-to-date.