{"_id":"563a4f61daf1c00d00136dc2","user":"546d17e2eb9cfd1400dd4529","githubsync":"","__v":4,"category":{"_id":"55773ab007e7110d001043ec","project":"55773a5ba042551900b002cb","pages":["563a4f1ddaf1c00d00136dc0","563a4f351846790d0089535b","563a4f47f0c29b1700daafdf","563a4f54c63a22190018dca3","563a4f61daf1c00d00136dc2","563a4fb9d25e8919005f3f3a","56707e6681801f0d00802f7e","56a91a3e2036420d002d234f","56afb741e0b1e40d00c53751","56afc6eb1486990d009c0f1c","56c35c4ba869d017002ea550"],"version":"55773a5ba042551900b002ce","__v":11,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-06-09T19:12:48.377Z","from_sync":false,"order":0,"slug":"introduction","title":"Introduction"},"parentDoc":null,"project":"55773a5ba042551900b002cb","version":{"_id":"55773a5ba042551900b002ce","project":"55773a5ba042551900b002cb","__v":18,"createdAt":"2015-06-09T19:11:23.764Z","releaseDate":"2015-06-09T19:11:23.764Z","categories":["55773a5ca042551900b002cf","55773a6ce6063e0d00481380","55773ab007e7110d001043ec","55773abaa042551900b002d5","55773ac207e7110d001043ed","55773acb07e7110d001043ee","55773ad3a042551900b002d6","55773adce6063e0d00481383","55773ae4a042551900b002d7","55773af307e7110d001043ef","55773af907e7110d001043f0","55773b0407e7110d001043f1","563a4f7ad25e8919005f3f39","563a4fcaa19edf0d00972321","564a70dc4cd0521700523edf","564b797bcc472d0d00da9435","564b855b766d4923004e1fd1","59cd4b81935249001c77c48e"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Motherboard","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-11-04T18:33:05.535Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"All requests and responses are of an `application/json` content type and follow typical HTTP response status codes for success and failure.\n\n* **200** - Everything is OK\n* **201** - Created Successfully\n* **202** - Accepted\n* **204** - No Content\n* **301** - Moved Permanently\n* **400** - Bad Request\n* **401** - Unauthorized\n* **404** - Not Found\n* **500** - Internal Server Error\n\nThe API follows the general rule that all 200 codes are deemed successful, 300 codes denote a redirection, 400 codes are client errors and 500 codes are server errors.\n\nIn addition to the status codes the body of the response is formatted to the [JSend standard](http://labs.omniti.com/labs/jsend) as detailed below.\n[block:api-header]\n{\n \"type\": \"basic\",\n \"title\": \"Success\"\n}\n[/block]\nA successful response is indicated by a HTTP status code in the 2xx range and will contain a status key of 'success' and a data key containing the body of the response (which optionally may be empty).\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"{ \\n \\\"code\\\":200,\\n \\\"status\\\":\\\"success\\\",\\n \\\"data\\\":[ \\n { \\n \\\"key\\\":\\\"value\\\"\\n }\\n ]\\n}\",\n \"language\": \"json\"\n }\n ]\n}\n[/block]\n\n[block:api-header]\n{\n \"type\": \"basic\",\n \"title\": \"Errors\"\n}\n[/block]\nWhen an API call fails due to a client error or an unauthorized request is made a 4xx HTTP status code will be returned together with a message key of 'fail' indicating the conditions that caused the failure.\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"{ \\n \\\"code\\\":400,\\n \\\"status\\\":\\\"fail\\\",\\n \\\"data\\\":{ \\n \\\"per_page\\\":[ \\n \\\"The per page may not be greater than 100.\\\"\\n ]\\n }\\n}\",\n \"language\": \"json\"\n }\n ]\n}\n[/block]\nWhen an API call fails due to an error with the server a 500 HTTP status code will be returned together with a message key of 'error' indicating the conditions that caused the error.\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"{ \\n \\\"code\\\":500,\\n \\\"status\\\":\\\"error\\\",\\n \\\"message\\\":\\\"Unable to communicate with database\\\"\\n}\",\n \"language\": \"json\"\n }\n ]\n}\n[/block]\n\n[block:api-header]\n{\n \"type\": \"basic\",\n \"title\": \"Types\"\n}\n[/block]\nUnless otherwise specified, all dates/timestamps from the API are returned in [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) format.\n\nDecimal numbers are returned as strings to preserve full precision across platforms. When making a request, it is recommended that you also convert your numbers to strings to avoid truncation and precision errors.\n\nInteger numbers such as unique identifiers used in each API are unquoted.\n[block:api-header]\n{\n \"type\": \"basic\",\n \"title\": \"Pagination\"\n}\n[/block]\nResults that return arrays of variable length are paginated. The pagination response will include all variables as described below:\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"{ \\n \\\"code\\\":200,\\n \\\"status\\\":\\\"success\\\",\\n \\\"total\\\":70709,\\n \\\"per_page\\\":10,\\n \\\"current_page\\\":1,\\n \\\"last_page\\\":7071,\\n \\\"next_page_url\\\":\\\"https:\\\\/\\\\/api.triathlon.org\\\\/v1\\\\/athletes?page=2\\\",\\n \\\"prev_page_url\\\":null,\\n \\\"from\\\":1,\\n \\\"to\\\":10,\\n \\\"data\\\":[ \\n { \\n \\\"key\\\":\\\"value\\\"\\n }\\n ]\\n}\",\n \"language\": \"json\"\n }\n ]\n}\n[/block]\nIn all paginated requests the parameters 'per_page' defines the number of results to be returned per page and 'page' indicates the page number to be returned.","excerpt":"","slug":"responses-and-status-codes","type":"basic","title":"Responses and Status Codes"}