Blog

API’s and API responses

When you query an API, you’re looking transpose the information within one system into another. As an example, I couldÂ use the Netshock API to create a mobile application with the intention of pulling data from the Netshock database into my app, so that I don’t have to re-type all of my articles.

When I do that, I’ll need to create an API key. That key is used as an identifier for the mobile app, which lets the Netshock database know that the app is authorized to access the information. Usually, that API key will be passed into a URL string, which will also include all the variables you’d like to query. This differs between API’s, but, most are well documented and you should be able to find all the information you need.

Often an API response is available in both JSON and XML. Depending how you’re building your app you might have a preference, but, for me, I usually use JSON API calls/responses.

Once you’ve queried an API (as per the instructions set out in the API documentation), you’ll get a response back. Below, I’ve provided a sample response from the Twillio API.

As you can see, the response is structured and easy to handle once it reaches your app. This is the sort of API response you should expect from most of the API’s you’ll be using (albeit with different fields). If you can handle the response of one API, you’ll be well prepared to handle most others.