Last updated
July 24, 2023

How to use an API

Emma Jagger

Table of Contents:

Get your free
API key now
4.8 from 1,863 votes
See why the best developers build on Abstract
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
No credit card required

An API, or Application Programming Interface, is a set of rules that define how computers and applications can communicate with each other. If you recall the old switchboards that operators used to field phone calls to their destinations, APIs are a little like that. A client makes a request to an API at an endpoint which it has access to. The API validates the request and passes the request to the destination server or program. The server sends a response back, first through the API, which then transfers it back to the client.  

How can we get started sending our own client requests? What are the first steps in actually using an API?  

Let’s send your first free
See why the best developers build on Abstract
Get your free api

What does an API do? 

There’s a wide range of API uses, but a common one is a comparison website where a user uses a web browser to compare flights. These compare cost, departure and arrival times, and total flight times in real-time. The comparison website is connecting to different airline website services using an API call and extracting data from them and presenting it on a web page for the user to make a quick and easy comparison.

What are the benefits of using APIs?

The are many practical benefits, but here’s a quick list:

  • It improves customer experiences as mentioned in the example above
  • It increases productivity by enabling fast software development without having to build everything from scratch
  • It reduces cost by minimizing what you need to build yourselves, often including the API itself
  • It encourages innovation in existing ecosystems by opening up the possibility to create interesting new products like micro-services used to manage clients, where previously separate systems become able to communicate in real-time
  • It enables automation of applications and services especially when using web APIs

To get started, you’ll need API documentation and a key for each API you need to use, but this is a good summary.

Are there different types of APIs?

Yes. Fundamentally there are four different types of APIs:

  • Public APIs (open APIs available from an API provider like Abstract for anyone to use)
  • Partner (only available to selected authorized developers or consumers)
  • Internal (a custom API developed internally)
  • Composite (a combination of multiple APIs where interdependency is required)

Top API management tools 

As you might imagine, if you develop a range of applications and web services, then that has the potential to get messy. So, you might benefit from getting ahead of this by using an API management tool. These enable admins to monitor and control APIs in a secure environment. The capability to monitor (e.g., using tools for data observability vs APM) can be important in terms of understanding and analyzing speed, reliability, errors, and security.

Some of the highest rated API management tools (by users) are:

  • Postman
  • Datamolino
  • Zapier
  • Essential Hub

How do APIs work?

Acting as a communication ‘middleman’ between two separate systems using rules (representational state transfer) that govern how this communication can take place. REST APIs work using URLs and an HTTP request, and are based on the following rules:

  • Client <-> server (client is the frontend, server is the backend and they’re independent from each other)
  • Uniform interface (this defines the interface between the client and the server while enabling both to develop independently)
  • Stateless (each call from the client to the server must contain all the information the server needs to process the call)
  • Cacheable (caching is the act of temporary storage of data so that it can be read again without the need for additional processing)Layered (each layer must be arranged in a hierarchy with each layer only able to see the layers it needs to interact with)
  • Code-on-demand (allows client functionality to be extended by applets and scripts to minimize the number of features you need to implement

Following this architectural style or constraints is what makes the application or service you develop RESTful.

How to use an API

To use an API, we issue HTTP requests using methods defined in the REST API architecture. This allows clients and servers to speak the same language.

Try an HTTP GET request

A GET request reads information from a record in the database. Let's try this with the Holidays API. Typing `curl '{YOUR_API_KEY}&country=US&year=2020&month=12&day=25` and ENTER in your terminal should return a status code and content that looks like this:

"name": "Christmas Day",
"name_local": "",
"language": "",
"description": "",
"country": "US",
"location": "United States",
"type": "National",
"date": "12/25/2020",
"date_year": "2020",
"date_month": "12",
"date_day": "25",
"week_day": "Friday"

Note on `{YOUR_API_KEY}`: You will need a free API key from Abstract API to accomplish the above request.

So, what happened in this GET request? The client (us) requested information from the API at `` by sending a GET request to the API. The additional request parameters `&country=US&year=2020&month=12&day=25` asked for public holidays in the US (`country=US`), in the year 2020 (`year=2020`), the month of December (`month=12`), and the 25th day (`day=25`). The API authenticated the request and made a call to the server. The server returned the requested information to the API, and the API sent the JSON card with the requested information back to the client (us).

This is a great, quick example of an API in action:

  • You used the GET request to request data from the API
  • The API request sourced relevant data from the server
  • The API data was then displayed for you

Depending upon the API you use, it might be returned as structured XML using the Simple Object Access Protocol (SOAP) or JSON.

API authentication

JSONPlaceholder is a helpful test resource, but what about API authentication? Most APIs require you to sign up for API keys to use their services. They will get a public key and a private key. The public key is to be used in request headers and URLs (where they will be visible), and a private key, to be used in server-to-server communication.  

Getting an API key is similar to signing up for any other service. We will use the Abstract API as an example. Go to the Abstract API and select Create Your Free Account. Enter your information and select Sign Up. You will receive a confirmation email with a link to your Abstract API dashboard. Navigate to any of the APIs listed, for example, the IP Geolocation API. This page displays your unique API key for this API, and has a host of console options for testing it out.

Testing your new token

You can test this API key in two ways:

  • A quick cURL request in your terminal: `{YOUR_API_KEY}`
  • Use the in-browser Abstract API console to test your new API with your new credentials.

What programming languages do I need to use?

APIs can be implemented in a range of languages including JavaScript, Python, PHP, Ruby, and more. Look at your API documentation or tutorials to learn more.

Where can I find more information on how to use APIs? 

We have a range of tutorials and API documentation on our website, but please contact us if you have any questions.


When you're just starting your web development journey, the API authentication can seem like a pain, but it's usually just a quick email application and you're in. Now your next step is learning the other requests you can perform in REST (like POST, PUT, and DELETE), and how to use APIs in your code to build efficient, powerful software.

Emma Jagger
Get your free
key now
This is some text inside of a div block.
get started for free

Related Articles

Get your free
key now
4.8 from 1,863 votes
See why the best developers build on Abstract
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
No credit card required