What is an API?

APIs: demystified

"Whew, not my section!" you think?

Maybe you have seen a section like this one on a website of Stripe or another company:

Here is the good news: You don't need to read such pages in order to still use an API for your own benefit. Let's find out how!

APIs are used to exchange information between different programs

Yup, that's it already! The rest is just fine print.

API stands for Application Programming Interface. What that means in simple terms: it is how two different programs communicate with each other. Much of what happens when you are browsing the Web is based on such APIs and it is becoming more and more common in software development these days.

colabel offers you an API to make predictions

... but that is just one way to access this information. We have recorded one example that shows you one of many alternative ways how you can access information produced by such an API. Thankfully, tools like Zapier make it easy nowadays to connect different applications (via their respective API!) and thus make them even more useful than they already are.

Going down the rabbit hole

In many cases, automating your tasks such as in the example above is sufficient to cover a huge range of processes and applications. If you want to understand a few more technical details, read on!

Requests and HTTP

It took me a long time to wrap my head around these two connected concepts when I first entered the world of the Web. The only explanation I have is that I had often seen "HTTP 400 Bad Request", followed by some form of disappointment that I could not reach the site that I wanted. Later on, I learned that those two are not that bad after all.

Making a request is similar to asking a question, except that the question has to contain certain elements (words) and follow a certain structure (grammar). The question goes from the client (your browser) to the server (a website database or website). In fact, every time you enter a URL into your browser, you are making a request.

There are different types of requests that are relevant for working with APIs, also known as request verbs. The most common ones are the following:

Let's just focus on the first two for now, GET and POST. When using GET, the server (see above!) is prompted with responding to a certain question: You want to see a list of your Facebook friends? That's a GET request in the background! In turn, when uploading a new picture to Instagram, that is a POST request to their servers: You send over some data from your client (your mobile app) to their database.

Responses and JSON

Unless there was an error in the request or data transfer, servers are kind enough to send you a response. In most cases nowadays, this response will be in the JSON format. This format is relatively easy to read and write, even if it looks a little bit odd at first:

If you want to go really wild, check out the official documentation – great content and 90s-websites throwback in one go.

In any case, this is what responses typically look like and you can already see that the format is very structured. And that is why computers can easily work with it.

Accessing the colabel API

Once you have trained your custom model, you will be able to see the API documentation that has been fully customized to you. It has a pre-configured POST request through which you can make all kinds of predictions. As a response, you will get a neatly formatted JSON file that always returns a response in the same format again.

Before we finish off, I want to restate again that you don't need to set up this API in any programming language. You can go alternative ways similar to the example we gave above. Happy requesting!

Still have a question?

Our Customer Success team is standing by to help.