Urban Airship's HTTP API uses common HTTP response status codes to let you know whether your requests succeeded or not.When we return an error code for an API call, it usually includes more information in the response. This information can be very valuable for troubleshooting, and is generally more descriptive than the status code alone.
If using command-line tools (like
curl) to make the request, crank up the verbosity (-v) to get more information on what's going wrong.
Some of the most common status codes are:
- 200/202 OK/Accepted - Your request worked! Note this just means that your request was accepted. Pushes may later be rejected by Apple, Google, etc.
- 201 Created - Your request worked and created something like a Tag (as opposed to updating an existing resource).
- 204 Deleted - Like 201 Created, but you successfully deleted a resource.
- 301 Moved Permanently - You're being redirect to another URL. Chances are you forgot the trailing slash on your request.
- 400 Bad Request - Your request failed. Most likely something was formatted improperly. The body of the response should give a hint as to what went wrong, but if it doesn't you might have forgotten to specify a Content-Type in the header, or the body was invalid JSON.
- 401 Unauthorized - No access credentials were supplied, or they are either incorrect or insufficient for the call you're making. Double check the application key and secret, and see if the API call you're making requires the master secret.
- 404 Not Found - The URL you sent your request to does not exist.
- 405 Method Not Allowed - The type of HTTP request you attempted is not allowed. For example you did a PUT to a URL that only supports GETs. You can see the list of valid methods in the response headers. One common case for 405s is that you attempted to PUT or POST to a URL without the trailing slash, received a 301 redirect response, and the HTTP library you're using followed the redirect but sent a GET without data.
- 5XX Internal Error - Oops, something broke on our end. It could be an improperly formatted request caused a bug in our servers, or it could be some other problem on our end. On the rare occasion that a 5XX status is received, retrying your request is best course of action to take. If a request continually fails with a 5XX status please feel free to contact support. In your support request, please provide as many pertinent details about the API request as possible - this will help ensure that the issue is promptly resolved.