Errors

Understand HTTP status codes and error responses from the LiGo API.

Resumen

LiGo uses conventional HTTP response codes to indicate the success or failure of an API request. In general: - Codes in the 2xx range indicate success - Codes in the 4xx range indicate an error from the provided information (e.g., missing required parameter, invalid authentication) - Codes in the 5xx range indicate server errors

Error Response Format

When an error occurs, the API returns a JSON response with the following: - error error code that identifies the specific type of problem that occurred - message field containing a description of what went wrong - documentation containing a URL to the documentation of the resource

json
{
  "error": "Error code specifiying what problem occurred",
  "message": "Error message describing what went wrong",
  "documentation": "URL pointing to the documentation of the resource"
}

Error Codes

List of machine-readable error codes:

Error CodeDescripción
MISSING_API_KEYAPI key was not entered when trying to access the endpoint
INVALID_API_KEYAPI key entered was invalid
RESOURCE_NOT_FOUNDThe resource you were trying to find/modify does not exist
PLAN_LIMITATIONThis resource is not available in your plan
PLAN_LIMIT_REACHEDYou have reached your plan limit
INVALID_INPUTYour request body contains invalid items
LINKEDIN_NOT_CONNECTEDYou have not connected your LinkedIn profile to LiGo
MISSING_LINKEDIN_URLYou have not given your LinkedIn username to LiGo
INTERNAL_SERVER_ERRORAn unexpected error occurred on our server or, our server is temporarily unavailable

HTTP Status Codes

200
OK

The request was successful.

201
Created

A new resource was successfully created.

400
Bad Request

The request payload is invalid or required fields are missing.

401
Unauthorized

Authentication failed or API key is missing/invalid.

404
Not Found

The requested resource could not be found.

405
Method Not Allowed

The HTTP method is not supported for this endpoint.

429
Too Many Requests

Rate limit exceeded. Please slow down your requests.

500
Server Error

An unexpected error occurred on the server.

503
Server Unavailable

Our server is temporarily unavailable.

Common Error Examples

Missing Required Field

Returned when a required field is not provided in the request body.

json
{
  "error": "INVALID_INPUT", 
  "message": "'post_text' is missing in the request body", 
  "documentation": "https://ligosocial.com/api-documentation"
}

Invalid Authentication

Returned when the API key is missing, invalid, or expired.

json
{
  "error": "INVALID_API_KEY", 
  "message": "Invalid API key", 
  "documentation": "https://ligosocial.com/api-documentation"
}

Resource Not Found

Returned when the requested resource does not exist.

json
{
  "error": "RESOURCE_NOT_FOUND", 
  "message": "No posts found", 
  "documentation": "https://ligosocial.com/api-documentation"
}

Handling Errors

Always check the HTTP status code of responses. Implement proper error handling in your application to gracefully handle different error scenarios and provide meaningful feedback to users.

Relacionado