🧠Knowledge Series #25: How to make basic API calls
Get some practical, hands on experience of using APIs and making API calls
🔒The Knowledge Series is a collection of easy to read guides designed to help you plug the gaps in your tech knowledge so that you feel more confident when chatting to colleagues. Clearly explained in plain English. One topic at a time.
If you’re a free subscriber and you’d like to upgrade to unlock them you can do so below. Or you can find out more about paid access here.
Hi product people 👋,
As Reddit gears up for its IPO, 2023 will be remembered by the company for its radical API monetization strategy that saw it create a major backlash which threatened the existence of many of its most popular communities.
If you’re keen to avoid a similar backlash, you can read more about how to develop your own product’s API monetization strategy here.Â
But in this Knowledge Series, we’re less interested in the strategic aspects of APIs and more interested in the practical realities of using them. And that means making API calls. If you’re non-technical, you might be wondering why you need to understand how to make API calls but having an understanding of how APIs work can help you piece together other aspects of the tech stack. It can also help to better understand reading API documentation since API docs often come with examples of how APIs can be called using programming languages, cURL and other methods.
We’ll take a look at the anatomy of an API call and we’ll use some free, open APIs that you can use to practise making API calls of your own.
Coming up:
How APIs work - a quick refresh
The anatomy of an API call and the different ways you can make API calls explained
Practical, real world examples using open APIs from NASA and Pokemon
Tools you can use during your day to day role
PS - If you missed our other API-based Knowledge Series, you can check them out here:
How APIs work - a quick refresh
The web is built upon the request and response model and APIs are no different. You request something specific from a server and you get back a response which gives you what you wanted.
As a quick refresh, product teams typically use APIs in 3 basic ways:
Integrating with third parties or exposing APIs to third parties
Fetching data
Internal architecture via microservices and other applications
Integrating with third parties or exposing your own API to a third party is probably the most common way non-technical team members first get introduced to the concept of APIs. You may be exploring third party tools to integrate into your own product or looking at ways you might be able to build an API of your own that you can offer to third parties but typically this involves reading API docs and figuring out how best to manage that API integration.
In each of these scenarios, APIs work by using API calls. But how do API calls actually work and what are some of the ways you can make API calls?
The anatomy of an API call
An API call is initiated by sending a request to an API endpoint, which is essentially a specific URL that exposes a certain functionality or data of an application or service. This request can be made over the web using the HTTP protocol which includes different methods (such as GET, POST, PUT, DELETE) that specifies the action to be performed, along with any necessary parameters or body data.Â
For example, if I want to get an image of a product in the Shopify API, I’d use the GET method. If I want to delete a product from my Shopify store, I’d use the DELETE method.
Here's some of the most common HTTP methods used in APIs, along with some real world examples:
How to initiate an API call
One of the more confusing aspects of APIs that’s difficult to grasp is the idea that API calls can be initiated in more than one way.
It’s possible to use a web browser, a third party API management tool or a programming language to make API calls.
If you’ve ever read through API documentation you’ll have probably come across a section which gives you examples of how API calls can be made. Typically they use examples which reference cURL, a mix of programming languages and other options. And for non-engineers, it can be difficult to understand what each of these options mean.
Here’s a summary of each of the different options available to product teams, along with an explanation of how each one works: