I’m not even sure anymore where I found this, but I have found this image to be a helpful resource when I need to be reminded of what the various API status codes mean

API Request Response codes

On thing I would note about status codes, is that they aren’t always correct. The status codes need to be set by the API and sometimes APIs aren’t setup to give back the correct status code. Most APIs only use a few of these status codes and so you might get a generic error code instead of the specific one related to the issue you are actually hitting. It also happens on occasion that there are bugs in the API that return the incorrect status code. When testing you want to pay attention to the status codes, but don’t just blindly trust them

One other thing to keep in mind is that there is some ambiguity in these codes as well. Sometimes an API programmer has to make a choice as to which status code to return and different APIs will sometimes make slightly different choices in what they return. Once again you will want to pay close attention to how the API you are testing uses them. Does it make sense? Is it helpful to the users?

Status codes are an important part of API testing and are often one of the things we check in API automation, so hopefully this list is helpful for you!

 

Photo by rawpixel on Unsplash

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s