Saltar al contenido principal

Understanding HTTP Response Codes

After making a request to a web service, you will be provided with an HTTP code to inform you about the status of your request. If the request fails, it will be an error code that can indicate the steps to take to resolve the issue.

For each operation, the expected status codes will typically be provided at the end of the interface. However, this list is not exhaustive. The codes that you may potentially encounter are described in the following handy guide:

Response Codes

200 OK

This is the general success code. It is the most common code, indicating that the request has been processed successfully.

201 CREATED

This code indicates that the creation has been successfully done (via POST or PUT methods). The "Location header" field will contain a link to the newly created entity. Depending on the situation, there may or may not be content in the "Response Body" field.

204 NO CONTENT

This code indicates that the request has been processed successfully, but there is no content to display in the "Response Body" field. This often happens with DELETE and PUT methods.

400 BAD REQUEST

This is the general code to indicate that processing the request has resulted in an invalid outcome. This can be due to domain validation errors, missing data, etc.

It doesn't make sense to repeat the request without modifying its syntax, as the result will be the same error code.

401 UNAUTHORIZED

This code indicates that the necessary authentication parameters are missing or invalid to use the API.

It is also the response when an access token expires after 15 minutes.

403 FORBIDDEN

This is the code returned when the user does not have permission to perform the operation.

404 NOT FOUND

This code is used when the requested resource cannot be found.

Puede ser un código de error general, por ejemplo, si el servicio quiere ocultar un código 401 o 403 por razones de seguridad.

405 MÉTODO NO PERMITIDO

Este es el código que indica que la URL en la que se basa la solicitud existe, pero el método HTTP llamado no es aplicable. Por ejemplo, se obtendrá un código 405 si se intenta utilizar el método POST cuando la API no admite la creación de este tipo de recurso con este tipo de método. En este caso, el campo "Allow" indicará los métodos permitidos. En nuestro ejemplo, sería: "Allow: GET, PUT, DELETE"

409 CONFLICTO

Este código indica que cumplir con la solicitud crearía un conflicto en el recurso. Esto puede incluir duplicados, como intentar crear dos perfiles con la misma información a través del método PUT, o cuando se intenta eliminar objetos raíz sin que esté prevista la eliminación en cascada de los objetos secundarios.

La fuente del conflicto se indicará en la respuesta de la solicitud.

429 DEMASIADAS SOLICITUDES

Este código significa que ha enviado demasiadas solicitudes simultáneamente o en un período de tiempo determinado. Actito permite un máximo de 5 solicitudes en paralelo. Si encuentra esto, le recomendamos que almacene en búfer sus llamadas, para que solo realice una sexta solicitud si una de las primeras 5 llamadas ha recibido una respuesta. Un error 429 también puede ocurrir si ha alcanzado el límite de importaciones masivas.

500 ERROR INTERNO DEL SERVIDOR

Este es el mensaje de error general cuando el servidor encuentra una condición inesperada que le impide cumplir con la solicitud. Este código nunca se devuelve intencionalmente, sino solo para errores en los que no se puede influir desde su lado.

Consejo

Todos los errores 4XX sugieren que hay algo incorrecto en su llamada y que se puede resolver investigándolo.

Sin embargo, un error 500 persistente probablemente requerirá que se comunique con el soporte.