Response Codes
When working with the Sensos API, understanding the meaning of various response codes is essential. These codes indicate the outcome of a request made to the API and help developers troubleshoot any issues that may arise during communication between their application and the Sensos system. Below is a list of standard HTTP response codes, along with their descriptions and suggested actions for handling them.
Success Codes
200 - OK
The request was successful, and the server returned the requested data. This code confirms that everything worked as expected.
Action: No action is needed. You can proceed with processing the returned data.
201 - Created
The request was successfully fulfilled, resulting in the creation of a new resource. This typically occurs when you send a POST request to create a new entity in the system.
Action: Check the response for the new resource's ID and other details, and ensure it has been correctly registered.
202 - Accepted
The request has been received and will be processed asynchronously. This code is common for requests that trigger long-running operations.
Action: Use the returned link (if provided) to check the status of the operation or query the result after some time.
Client Error Codes
400 - Bad Request
The server could not process the request due to invalid syntax or missing parameters. This often happens when the request body or query parameters don’t match the expected format.
Action: Review the request and ensure all required fields and parameters are correctly formatted and included.
401 - Unauthorized
The request lacked proper authentication credentials or the provided credentials were invalid.
Action: Ensure that the correct authentication token is included and has not expired. Re-authenticate if necessary.
403 - Forbidden
The server understood the request but refuses to authorize it. This typically occurs when the authenticated user does not have permission to access the requested resource.
Action: Verify that the user or application has the necessary permissions to perform this action.
404 - Not Found
The server could not find the requested resource. This can happen if the resource ID is incorrect or if the endpoint is wrong.
Action: Double-check the URL or resource ID and ensure that it exists on the server.
429 - Too Many Requests
The user has sent too many requests in a short period. This response indicates that you are being rate-limited.
Action: Implement exponential backoff or limit the number of requests you send. Consult the API documentation for rate limits.
Server Error Codes
500 - Internal Server Error
The server encountered an unexpected condition that prevented it from fulfilling the request.
Action: Retry the request after some time. If the issue persists, contact support for further investigation.
502 - Bad Gateway
The server was acting as a gateway or proxy and received an invalid response from the upstream server.
Action: Retry the request after a short delay. If the issue persists, it may indicate a problem with the upstream service.
503 - Service Unavailable
The server is temporarily unable to handle the request due to maintenance or overloading.
Action: Retry the request after a delay or check for any system maintenance notifications.
504 - Gateway Timeout
The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.
Action: Retry the request with a longer timeout value or check if the upstream service is experiencing issues.
Note: For more detailed information on response codes and troubleshooting, please refer to the full API documentation or reach out to Sensos Support.
Updated 2 months ago