HTTP Verbs and Error Codes (legacy)

HTTP Verbs

Where possible, our API uses these HTTP verbs for each action:

VerbDescription
GETRetrieve resources.
POSTCreate resources or other types of content submission.
PUTUpdate resources. Note: some types of resources can't be updated.
DELETEDelete resources. A successful delete returns a 200 or 204 response, and no body is included.

Success Codes

If your request is successful, you receive one of the following status codes:

  • 200 OK
    Success (for example, resource was updated or retrieved). Note: a body isn't always returned.

  • 201 Created
    A new resource has been successfully created (a Thng, collection, and so on). The Location header contains the URL of the resource. The response body contains the new resource created.

  • 202 Accepted
    The request was accepted and will be fulfilled asynchronously. Usually, the resource can be polled for completion status.

  • 204 No Content
    The request was successful, but there are no results to return. An example of this is a DELETE operation.


Error Codes

When calling our API, you might get an error code, which you must handle within your application. Errors can happen because your API request didn't follow our rules, or because our services are having a temporary problem.

  • 400 Bad Request
    If you send an incorrect JSON document (for example, a "}" is missing), or if the syntax/content is incorrect.

  • 401 Unauthorized
    The access credentials (in the Authorization header) are missing or invalid.

  • 403 Forbidden
    The credentials you provided are valid, but you aren't authorized to access the resource you're looking for.

  • 404 Not found
    Returned when the request is valid, but the resource you tried to access doesn't exist, or is outside your scope.

  • 405 Method Not Allowed
    The verb/method you used in the request isn't supported for this resource.

  • 415 Unsupported Media Type
    Returned when the format you requested (for example, XML) isn't supported for this resource. Note: We support only application/json as the content type.

  • 500 Internal Server Error
    An error has occurred on the EVRYTHNG server. If you see this error, contact us and include details of the request you tried and the response you received.

  • 503 Service Unavailable
    This error is usually returned when an external service that needed to fulfill your request didn't reply.

  • 504 Gateway Timeout
    A service required to fulfill the request wasn't available.

Error Messages

Errors return a response body in JSON format with one or more error messages to help you understand what went wrong. Below is an example of such an error response:

HTTP/1.1 401 Unauthorized
Content-Type: application/json

{
  "status": 401,
  "errors": [
    "Access denied, please check your credentials!"
  ],
  "code": 33619968,
  "moreInfo": "https://developers.evrythng.com/docs/authentication"
}

All error objects have status and errors properties, which help your HTTP client handle the problem appropriately. A code field might also be included to let you know what's wrong with the request.

These are some of the possible error codes:

Error CodeDescription
INVALID_IDThe format of a resource identifier is incorrect.
INVALID_CONTENTA required field or parameter for the resource hasn't been set.
INVALID_STATEThe state of a resource doesn't allow fulfilling a request.
MISSING_RESOURCEA resource doesn't exist.
ALREADY_EXISTSAnother resource has the same value for this field, which can happen when the field is used as a unique key (for example, the email address of a user).
ACCESS_FORBIDDENA resource doesn't allow access with the provided credentials.
METHOD_FORBIDDENA resource doesn't allow using the verb with the provided credentials (for example, when the user has limited permissions to read content (GET)).