{"_id":"59a73559c6cb7d001b12ca7b","project":"568bdc1483d2061900d86cdc","version":{"_id":"59a72290d61777001b6c42c3","project":"568bdc1483d2061900d86cdc","__v":19,"createdAt":"2017-08-30T20:39:44.453Z","releaseDate":"2017-08-30T20:39:44.453Z","categories":["59a7236e3fe4d90025117c10","59a72eb6cb0db3001b84cfe2","59a734eb757d030019b85af8","59c0243b1b2d07001a9d2b76","59c035e42126e10028effb12","59c06c40df5b3c0010584a13","59c1a5852cabe5002641a3e7","59c2fb00b2b45c0010b7a3d7","59c32ceb9aea850010ac4130","59c32e6e190c90003cb0d12f","59c33affb2b45c0010b7aa23","59c7dfa457bd8200105444dc","59c7e975c50cf30010d712a0","59cffdef0cd4dd0010294d54","59d0622ca91a810032c8f60c","59d06733c1aec60026253065","59d174d44ac471001a07b123","59d5a5e323e6e800103defb2","59ecf1d8ed507c001c52b255"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.0.0","version":"0"},"category":{"_id":"59a734eb757d030019b85af8","project":"568bdc1483d2061900d86cdc","version":"59a72290d61777001b6c42c3","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-08-30T21:58:03.883Z","from_sync":false,"order":6,"slug":"rest-api-usage","title":"REST API Usage"},"user":"58cc41f21751ce2f003be3b7","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-08-30T21:59:53.256Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"# Overview\n\nThe Droplit REST API uses a variety of standard JSON responses and HTTP status codes in specific contexts. These responses and status codes are described in detail below.\n\nEach status code documented in a REST endpoint links back to its details on this page. The REST endpoint pages themselves highlight the specific context in which that status code appears, rather than repeating the standard structures. Any deviation from the standard structures is described in depth on the relevant endpoint page.\n\nIf any other status codes or unusual structures are returned from an endpoint, which are not documented here, or a JSON response is given that is not documented in a specific endpoint, please contact Droplit to report it.\n\n# 200 (Success)\n\nMost endpoints return a 200 status when they have been executed correctly. This status always contains a JSON object if a payload is requested, and often contains JSON objects in other contexts. However, it may not always contain a JSON object.\n\n# 201 (Created)\n\nEndpoints that successfully create a new resource return a 201 status. This status sometimes includes a JSON object documenting the object that was created, but does not always.\n\n# 400 (Bad Request)\n\nAn endpoint returns a 400 status when its request is malformed. This is usually returned when the validation of parameters fails, but can also be returned in other contexts. The full response includes a JSON object which contains details on what is malformed in the request.\n\nThe individual API endpoints do not list every possible JSON object that may be generated from a bad request. Instead, they list the type of bad request, with a summary of what is found in the error object. This summary, along with the error object, should clafify any error caused by a usage mistake.\n\nAn error response such as the following, for example, would be listed as \"No Query String Allowed\" or \"Query Field Not Allowed,\" depending on the needs of a particular endpoint. In order:\n1. The error happened because of invalid parameters.\n2. The error was in the query string.\n3. One or more values specified in the query string were not allowed as parameters. \n\n```\n{\n\t\"errorType\": \"InvalidParams\",\n\t\"errors\": [\n\t\t{\n\t\t\t\"in\": \"query\",\n\t\t\t\"message\": \"contains fields that are not allowed: [ ADDITIONAL-FIELD-NAMES ]\",\n\t\t\t\"path\": \"additional parameters\"\n\t\t}\n\t]\n}\n```\n\n# 401 (Unauthorized)\n\nAn endpoint returns a 401 status when authentication has failed, an incorrect token type has been given for an endpoint, or authentication is required and has not been provided. The status means that the system cannot identify the user as authentic, for security reasons.\n\n# 403 (Forbidden)\n\nAn endpoint returns a 403 status when the user is authenticated, but is not authorized to run the endpoint. This can happen in the following ways:\n* The user has a valid token, but that token type is invalid for the endpoint in question.\n* The user is trying to access a resource through a container which doesn't encapsulate that resource.\n\n# 404 (Not Found)\n\nAn endpoint returns a 404 status when the resource it is trying to access does not exist. The request is semantically correct, but refers to a non-existent record in the system.\n\n# 405 (Method Not Allowed)\n\nAn endpoint returns a 405 status when a user attempts to use an HTTP verb that is not supported. The OPTIONS verb is supported on all endpoints, as described in the REST API usage techniques, and shows which HTTP verbs a particular endpoint supports.\n\n# 500 (Internal Server Error)\n\nAn endpoint returns a 500 status when something has gone wrong on the Droplit server side. There are instances in which this is to be expected, when the server runs into an operation it cannot complete. If this error occurs in a call that was anticipated to run properly, however, please contact Droplit to report it.\n\n# 503 (Service Unavailable)\n\nAn endpoint returns a 503 status when something on the Droplit server is not currently available, usually for maintenance or similar purposes. The service should be restored in short order without any action from the user. Please contact Droplit if a service is down for more than 24 hours.","excerpt":"","slug":"rest-api-standard-responses","type":"basic","title":"Standard Responses"}

Standard Responses


# Overview The Droplit REST API uses a variety of standard JSON responses and HTTP status codes in specific contexts. These responses and status codes are described in detail below. Each status code documented in a REST endpoint links back to its details on this page. The REST endpoint pages themselves highlight the specific context in which that status code appears, rather than repeating the standard structures. Any deviation from the standard structures is described in depth on the relevant endpoint page. If any other status codes or unusual structures are returned from an endpoint, which are not documented here, or a JSON response is given that is not documented in a specific endpoint, please contact Droplit to report it. # 200 (Success) Most endpoints return a 200 status when they have been executed correctly. This status always contains a JSON object if a payload is requested, and often contains JSON objects in other contexts. However, it may not always contain a JSON object. # 201 (Created) Endpoints that successfully create a new resource return a 201 status. This status sometimes includes a JSON object documenting the object that was created, but does not always. # 400 (Bad Request) An endpoint returns a 400 status when its request is malformed. This is usually returned when the validation of parameters fails, but can also be returned in other contexts. The full response includes a JSON object which contains details on what is malformed in the request. The individual API endpoints do not list every possible JSON object that may be generated from a bad request. Instead, they list the type of bad request, with a summary of what is found in the error object. This summary, along with the error object, should clafify any error caused by a usage mistake. An error response such as the following, for example, would be listed as "No Query String Allowed" or "Query Field Not Allowed," depending on the needs of a particular endpoint. In order: 1. The error happened because of invalid parameters. 2. The error was in the query string. 3. One or more values specified in the query string were not allowed as parameters. ``` { "errorType": "InvalidParams", "errors": [ { "in": "query", "message": "contains fields that are not allowed: [ ADDITIONAL-FIELD-NAMES ]", "path": "additional parameters" } ] } ``` # 401 (Unauthorized) An endpoint returns a 401 status when authentication has failed, an incorrect token type has been given for an endpoint, or authentication is required and has not been provided. The status means that the system cannot identify the user as authentic, for security reasons. # 403 (Forbidden) An endpoint returns a 403 status when the user is authenticated, but is not authorized to run the endpoint. This can happen in the following ways: * The user has a valid token, but that token type is invalid for the endpoint in question. * The user is trying to access a resource through a container which doesn't encapsulate that resource. # 404 (Not Found) An endpoint returns a 404 status when the resource it is trying to access does not exist. The request is semantically correct, but refers to a non-existent record in the system. # 405 (Method Not Allowed) An endpoint returns a 405 status when a user attempts to use an HTTP verb that is not supported. The OPTIONS verb is supported on all endpoints, as described in the REST API usage techniques, and shows which HTTP verbs a particular endpoint supports. # 500 (Internal Server Error) An endpoint returns a 500 status when something has gone wrong on the Droplit server side. There are instances in which this is to be expected, when the server runs into an operation it cannot complete. If this error occurs in a call that was anticipated to run properly, however, please contact Droplit to report it. # 503 (Service Unavailable) An endpoint returns a 503 status when something on the Droplit server is not currently available, usually for maintenance or similar purposes. The service should be restored in short order without any action from the user. Please contact Droplit if a service is down for more than 24 hours.