Errors ​
Sometimes requests to the API are not successful - failures can occur for a wide range of reasons. In all cases, the API should return an HTTP Status Code that indicates the nature of the failure (below), with a response body in JSON format containing additional information.
Failed API calls also record an Audit Event in Passwordstate which can be queried and reported on.
200 - Success. If data was requested, it will be available in the data field at the top level of the response body.
201 - Success (for object creation). Its information is available in the data field at the top level of the response body. The API URL where the object can be retrieved is also returned in the Location header of the response.
204 - No Content. Successful deletion of a record.
400 - Invalid request. Issues with Parameters - This usually occurs because of a missing or malformed parameter. Check the documentation and the syntax of your request and try again.
401 - No authorization. APIKey Issues - A valid API key was not provided with the request, so the API could not associate a user with the request, or a Password with a Password List, etc.
403 - Forbidden. Failed some form of 'compliance' check when adding/updating data, or the API key and request syntax was valid but the server is refusing to complete the request - This can happen if you try to read or write to objects or properties that the user does not have access to.
404 - Not found. Either the request method and path supplied do not specify a known action in the API, or the object specified by the request does not exist.
500 - Server error. There was a problem on Passwordstate website.
In the event of an error, the response body will contain an errors field at the top level. This contains an array of at least one error object, described below:
message - The type of HTTP Error description i.e. Not Found, No Authorization, etc
phrase - A description of the error. i.e. Invalid API Key, or record does not exist in the database, etc