{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","settings":"","params":[],"results":{"codes":[]}},"next":{"description":"","pages":[]},"title":"Errors","type":"basic","slug":"errors","excerpt":"","body":"You can use the HTTP status code of the response to an API call to determine if there is an error.\n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"HTTP Status Code\",\n \"h-1\": \"Meaning\",\n \"0-0\": \"`200`\",\n \"1-0\": \"`400`\",\n \"2-0\": \"`401`\",\n \"4-0\": \"`500`\",\n \"h-2\": \"Data Format\",\n \"0-1\": \"**Success** - The API call was successful - there are no errors.\",\n \"2-1\": \"**Unauthorized** - The API call failed - authentication via the access_token failed. A `message` attribute will explain the error.\",\n \"2-2\": \"`JSON` - A \\\"message attribute will explain the error.\",\n \"4-1\": \"**Internal Server Error** - An unknown error occurred - probably caused by a bug in the API.\",\n \"4-2\": \"N/A\",\n \"1-2\": \"`JSON` -\",\n \"0-2\": \"`JSON`\",\n \"1-1\": \"**Bad Request** - The API call failed - the API call is being used incorrectly. A parameters is missing, unexpected, or incorrectly formatted. A `message` attribute will explain the error.\",\n \"3-0\": \"`404`\",\n \"3-2\": \"`JSON` - A \\\"message attribute will explain the error.\",\n \"3-1\": \"**Resource Not Found** - The requested resource does not exist. This might mean the identifier you're using to access a resource is incorrect. A `message` attribute will explain the error.\"\n },\n \"cols\": 2,\n \"rows\": 5\n}\n[/block]\n\n[block:api-header]\n{\n \"title\": \"Examples\"\n}\n[/block]\nHere's an example of an API error caused by providing an unrecognized parameter to an API call:\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"curl -v -X GET https://tophatter.com/merchant_api/v1/products.json \\\\\\n-d 'access_token=YOUR_ACCESS_TOKEN' \\\\\\n-d 'foo=bar'\\n\\n< HTTP/1.1 400 Bad Request\\n< Access-Control-Allow-Origin: *\\n< Content-Type: application/json; charset=utf-8\\n< Cache-Control: no-cache\\n\\n{\\n \\\"message\\\": \\\"The following parameters were provided but are not recognized: foo.\\\"\\n}\",\n \"language\": \"curl\"\n }\n ]\n}\n[/block]\nHere's an example of an API error caused by providing an invalid identifier to an API call:\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"curl -v -X GET https://tophatter.com/merchant_api/v1/variations/retrieve.json \\\\\\n-d 'access_token=YOUR_ACCESS_TOKEN' \\\\\\n-d 'identifier=6631A'\\n\\n< HTTP/1.1 404 Not Found\\n< Content-Type: application/json; charset=utf-8\\n< Cache-Control: no-cache\\n\\n{\\n \\\"message\\\": \\\"There is no variation with the unique ID 6631A.\\\"\\n}\",\n \"language\": \"curl\"\n }\n ]\n}\n[/block]","updates":["5d7b1c4fb35dd7002d7dcc44"],"order":3,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"56a979dbf834950d0037b369","parentDoc":null,"project":"567f0c06143cc60d00c1fdbe","user":"567f0baca74a1c0d003e1fba","version":{"version":"1","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["567f0c07143cc60d00c1fdc2","56a9783109cb9c0d00f0c7d3","56a97837f834950d0037b363","56a9783b2d8fd90d0036eed6","56a979912d8fd90d0036eed8","5834b5691a80690f00d31faf","5834b5e4f775120f00c45f9d","5bf1a1473031e4005075ae14","5c64c200244bda003204b97f"],"_id":"567f0c06143cc60d00c1fdc1","__v":9,"createdAt":"2015-12-26T21:52:06.734Z","releaseDate":"2015-12-26T21:52:06.734Z","project":"567f0c06143cc60d00c1fdbe"},"category":{"sync":{"isSync":false,"url":""},"pages":["56a979a12bb3910d000ee941","56a979d5f834950d0037b367","56a979dbf834950d0037b369","56abe05035138c0d005c94da","56abe0670b9e0b0d006162b7"],"title":"API Usage","slug":"api-usage","order":0,"from_sync":false,"reference":false,"_id":"56a979912d8fd90d0036eed8","createdAt":"2016-01-28T02:14:41.926Z","version":"567f0c06143cc60d00c1fdc1","__v":5,"project":"567f0c06143cc60d00c1fdbe"},"__v":8,"githubsync":"","createdAt":"2016-01-28T02:15:55.569Z"}