Debugging API Error Codes

Highlights of possible errors and how to resolve them.

HTTP Status Code 400 - No JSON object could be decoded

If you receive a 400 with just the string “No JSON object could be decoded”, the data block of your POST/PUT/PATCH is invalid JSON. Run it through a JSON parser to identify what is incorrectly encoded in your packet and submit again.

HTTP Status Code 400 - {“errors”: …} block

If you receive a 400 with a JSON document containing only an “errors” key, this almost always indicates a validation error in the submitted data. The errors key contains a hash of keys named after the various fields, and an error message appropriate to that field for the value. The “_” key or “” (empty) key represents errors that do not apply to a specific field or other general validation issues.

An example:

{
    "errors": {
        "": "The username \"joe\" already exists, please select another."
    }
}