We haven’t done basics for a while, so let’s start with what an API is and isn’t. It’s important to know what we mean by “testing APIs”.

An API is: Application Programming Interface. Fancy words for how to let other computers talk to mine or yours. Or really, any software to our software.

It doesn’t have to be “servers” or “microservices” – any library you use, exposes APIs, so you could use it. But in our modern world, when we say “API”, we usually mean the APIs that servers expose, so we can use their services.

There can be many types of APIs. Any server can decide how others should talk to them. But it would be best, if everyone would talk the same language. That’s why we have standards. Today, that standard is called REST.

Well, not really. REST (representational state transfer) isn’t a standard – it’s a type of architecture. It uses HTTP and XML and JSON, which ARE standards.

But the term REST is used the most. Like here:

Example of A POST API.

It’s a POST method, a URL and a JSON body. We may also call the URL an “EndPoint”. This is an HTTP request, or what we call a REST API.

But there are other APIs. For example, there’s also GraphQL, which looks like this:

An example GraphQL example

While with REST, we expose many endpoints, with GraphQL there’s only one endpoint. What changes is the body, which frames the queries. We send a query structure, and the server fills in the blanks.

An example of GraphQL response

There are other types of APIs. like Google’s gRPC. This one has custom format (unlike the HTTP-based REST and GraphQL). You define the content and structure. It’s much lighter than HTTP (in term of bytes passing around), and gives higher performance.

So when we’re talking about APIs, there’s a lot bigger world than just REST. It is possible for an application to expose multiple interfaces to access the same data. When we’re testing it, we’ll need to check the both retrieve the same data (for example).

Sometimes, an application might expose REST APIs to the rest of the world, but internally, it will us use gRPC, for better performance. We’ll need to test the application in differnt contexts.

APIs are complex, and the fact that they come in many flavors, just make testing even more complex.
I mean interesting.

If you’re interested in diving into the world of API Testing, check out the “API Testing for Developers” and “API Testing with Postman” for testers workshops.

Categories: API testing

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *