Errors

Any unsuccessful HTTP request, i.e not in the 2XX range, will have the following structure.

JSON representation
JSON representation
{
"error": string,
"error_description": string
}

Fields

Field

Data Type

Description

error

string

The type of error.

For example, Unauthorized, Forbidden e.t.c

Unhandled errors have the type HttpRequestError.

error_description

string

A human readable error description.

You can log this on your application back-end

but avoid displaying it your users.

Unexpected server errors will usually have a status code in the 5XX range while known exceptions will usually have a status code in the 4XX range. Some of the common HTTP error status codes you might encounter are outlined below.

HTTP Status Code

Description

400

You sent a bad request. It could be an invalid URL or request entity. The error description will usually give a much more detailed explanation.

401

You are not authorized to perform this request.

403

You do not have permission to access this resource.

You should contact the resource owner to give you access.

404

The resource you are trying to access does not exist.

409

The resource you are trying to create already exists.

You can handle this error in your application by getting the resource instead.

413

The request payload you are trying to post is too large.

The maximum payload size is 5 MB.

422

The URL and request entity are valid, but the service was unable to complete the request because of a logical error or constraint. The error description will usually give a much detailed explanation.

429

You have made too many requests within a short period of time.

Some weza.io endpoints are rate limited to prevent abuse and ensure up-time.

500

Internal server error.