Skip to main content

Errors

In case of API request failure, an HTTP error status is returned.

The HTTP response may contain a JSON object with additional informations.

Example: User not found

Request:

GET /api/users/foo-bar HTTP/1.1
Host: api.fairjungle.com
Authorization: Bearer TIAnRrvnKaiJAlEorDGwPKbMm6v4Itod

Response:

HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8
Content-Length: 46
{
"code": "notFound",
"message": "User not found"
}

Example: Invalid user fields

Request:

POST /api/users HTTP/1.1
Host: api.fairjungle.com
Content-Type: application/json
Authorization: Bearer TIAnRrvnKaiJAlEorDGwPKbMm6v4Itod
Content-Length: 62
{
"data": {
"email": "use r@test.com",
"lang": "foo"
}
}

Response:

HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json; charset=utf-8
Content-Length: 262
{
"code": "validationFailed",
"invalid": [
{
"code": "email",
"field": "email",
"message": "The 'email' field is invalid",
"value": "use r@test.com"
},
{
"code": "lang",
"field": "lang",
"message": "The 'lang' field is invalid",
"value": "foo"
}
],
"message": "Resource validation failed"
}

Example: Invalid query parameter

Request:

GET /api/users?limit=500 HTTP/1.1
Host: api.fairjungle.com
Authorization: Bearer TIAnRrvnKaiJAlEorDGwPKbMm6v4Itod

Response:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 184
{
"code": "invalidParam",
"invalid": [
{
"code": "paramValue",
"field": "limit",
"message": "the limit parameter must be between 1 and 100",
"value": "500"
}
],
"message": "Invalid parameter provided"
}

Example: API Key unauthorized

Request:

GET /api/users HTTP/1.1
Host: api.fairjungle.com
Content-Type: application/json
Authorization: Bearer foobar

Response:

HTTP/1.1 401 Unauthorized
Content-Length: 0