The HTTP response status codes that PetHub API utilizes are currently:
- 200 - OK
- 201 - Created
- 400 - Bad request
- 404 - Not found
- 500 - Internal server error
In addition to returning an HTTP response to a request to a PetHub.io API, we hope to actually provide some helpful information in the event of an error (but, if we miss that mark, please let us know so we can do our best to address it).
Request Errors
In addition to the HTTP response code above being returned, when an error occurs we will endeavor to have it include the following fields to help you (and possibly us) in diagnosing the problem:
- response_code - HTTP status code (see above)
- message - verbose, plain language description of the problem with hints of how to fix it
- more_info - link to any supporting documentation
- code - API error code defined in the PetHub API documentation to further identify the issue
For example, let's attempt to look-up the information for our beloved Grizzly (the original tester dog) where an access token is not included in the Header of the request:
curl GET https://pethub.io/v1/pets/321 Should have been: curl -H "Authorization: Bearer abc123" GET https://pethub.io/v1/pets/321
The response would look something like the following:
HTTP Status Code: 401 { "response_code" : "401", "message" : "Header is missing or includes an invalid access token", "more_info" : "https://pethub.io/api/v1/auth,https://pethub.io/errors/202201100", "code" : "202201100" }