Errors

API Errors

Overview

When interacting with the OCUS API, errors may occur due to invalid requests, authentication issues, or system failures. This document outlines the common error responses, their meanings, and how to handle them effectively.

Common Error Codes

CodeHTTP StatusDescription
invalid_request400The request contains missing or invalid parameters.
unauthorized401Authentication is missing or invalid.
forbidden403The client does not have permission to access this resource.
not_found404The requested resource does not exist.
method_not_allowed405The HTTP method used is not supported for this endpoint.
conflict409The request conflicts with the current state of the resource.
rate_limited429Too many requests were made in a short period.
server_error500An internal server error occurred.
service_unavailable503The API is temporarily unavailable.

Handling Errors

Client-Side Errors (4xx)

Errors in the 400-499 range indicate issues with the request. Clients should:

  • Verify request parameters and authentication credentials.
  • Check permissions before making a request.
  • Implement proper validation before sending requests.

Server-Side Errors (5xx)

Errors in the 500-599 range indicate server-side issues. Clients should:

  • Implement retry logic with exponential backoff for temporary failures.
  • Log errors and report recurring issues to OCUS support.

Error Logging and Debugging

  • Enable API Logging: Track failed requests and responses for troubleshooting.
  • Monitor API Usage: Avoid exceeding rate limits.
  • Check Response Headers: Some errors may include additional debugging information in the response headers.

By handling errors correctly, clients can improve the reliability and robustness of their integration with the OCUS API.