An API, or Application Programming Interface, is a way of communication between various software components. It is a method in which applications give access to their data in a structured way, without the need of interacting with the user interface.
Basically, someone creates a software and gives you access to parts of it via an API.
What are APIs?
An Application Programming Interface (acronym of API) is a mechanism that allows two software components to communicate with each other.
For instance, when you search something on Google, a series of APIs are used by Google to get search results, images, videos and any other search result types.
Types of Application Programming Interfaces
The word API often refers to Web APIs, which allow the communication of softwares connected to the Internet.
There are, however, other types of APIs:
- APIs for Programming Languages
- APIs for Software Libraries
- APIs for Operating Systems
- APIs for Computer Hardware
Different types of Web APIs
A Web API is an API (Application Programming Interface) for the Web.
There are different categories of APIs depending on the level of privacy, or security, needed to access the API:
- Open APIs
- Internal APIs
- Composite APIs
- Partner APIs
Open APIs are APIs that are publicly available to any user.
It is also called public APIs which are available to any other users. Open APIs help external users to access the data and services. It is an open-source application programming interface in which we access with HTTP protocols.
Internal APIs are private APIs used by companies to let applications communicate with each other.
Examples of internal APIs: Google Apps interacting with Knowledge Graph
Composite APIs is a collection of service APIs. They are APIs that combine multiple web APIs into one and allow web developers to call multiple endpoints in single call.
Examples of composite APIs: shopping cart requiring multiple APIs for each feature
Partners APIs are APIs requiring the developer to have specific rights or licenses in order to access. Partner APIs are not available to the public.
API Protocol Types
An API protocol defines the rules necessary to perform an API call (types, commands, etc.).
Different API architecture require different protocols.
There are four main categories of API protocols that allow communication between client and servers (in order of creation):
- RPC APIs
- SOAP APIs
- REST APIs
RPC APIs, also known as Remote Procedure Call, APIs are the earliest and simplest types of API.
RPC started with XML-RPC and later incorporated JSON-RPC versions. Later Google incorporated the general purpose RPC (or gRPC).
- XML-RPC: Remote procedure call encoded in XML
- JSON-RPC: Remote procedure call encoded in JSON
- gRPC: Remote procedure call that can run in any environment
In the world of micro-services, gRPC has seen adoption from Facebook’s Apache Thrift and Twitch’s Twirp.
The simplicity of RPC makes a lightweight solution to improve the performance of APIs that face large amount of network requests.
SOAP APIs is an API format created by Microsoft to overcome some of the challenges of the XML-RPC API type.
SOAP APIs, also known as Simple Object Access Protocol APIs, use the XML format to define the structure of the communication.
SOAP APIs is a verbose way to communicate with XML. It has an advantage over XML-PRC as it can distinguish between data types.
SOAP is still used by applications like Salesforce as it allows encryption using security tokens within the SOAP envelope.
It is also useful as SOAP can chain messages so that the server “remembers” previous requests. This is interesting for booking and commerce applications that want to keep track of user requests to improve purchase funnel. This can however bring additional load on the servers.
REST APIs, also known as Restful APIs, are web APIs that conform to the requirements of REST architectural style and allow for interaction with RESTful web services.
REST APIs quickly became more popular than SOAP APIs.
It uses HTTP technologies found in web browsers and servers to make data available as resources.
- Uniform interface regardless of device or application type
- Each request is treated as new (stateless). No need to store anything about the session
- Allows server to return executable code
- Uses HTTP caching to reduce the load on the server
- Layered system that allows scalability on the server-side
REST stands for REpresentational State Transfer.
GraphQL is a data query language created by Facebook that uses a schema to reduce the number of endpoints and allow the client (instead of the server) to decide how the data is returned.
With REST APIs, you call and endpoint and get back the entire response from the server that you then need to parse to get the data you need. With GraphQL, you define the schema of what you want to get and receive only the specific data that you request for, no more, no less.
GraphQl makes requests more complex, but optimizes the payload.
Here is a simple reminder table of the 4 types of application programming interface types.
|Web API Type||Format|
|RPC APIs||JSON, XML, Thrift|
|REST APIs||XML, JSON, HTML, Text|
Example of APIs
There are so many APIs out there to count. The APIs I use the most are:
- Google APIs (Search Console API, Analytics API, YouTube API, Sheets API, Google Maps API, Knowledge Graph API, Pagespeed API, Indexing API, URL Inspection tool API)
- Social Media APIs (Reddit API, Facebook API, LinkedIn API, Twitter API)
- Business Sharing APIs: Slack API, Gmail API
- Content APIs: Wikipedia API, News API, Jobs API, Exchange rate API
- Other Marketing APIs: SEMRush API, Ahrefs API, Archive.org API, Yoast SEO API
How to Use APIs in Python
You can use Python to interact with various APIs. Here are a few tutorials that we’ve built for you.
Google Search Console API
- Authorise Requests to GSC API Using OAuth 2.0
- Extract Query by Page Using the Searchconsole API wrapper (Python)
- Get All Your Search traffic With Google Search Console API (With Code Sample)
- Get List of Verified Properties using Google Search Console API and Python
- Google Search Console (GSC) – Complete Guide
- Google Search Console API: Complete Guide (in 4 Chapters)
- Google URL Inspection API with Python
- How to Get Google Search Console API Keys
- How to Use Google Search Console API With Python
- How to use Google Search Console API with R
- Intro to GSC API with Python (Video)
- TF-IDF on Google Search Console Data
- Upload Sitemaps to Google Search Console with the API (Python)
- What is Google Search Console API and How to Use It?
- Get Reddit API Credentials with PRAW
- How to use Reddit API With Python (Pushshift)
- Post on Reddit API With Python (PRAW)
- Reddit API with Python (Complete Guide)
- Reddit API Without API Credentials
- Reddit API’s JSON Documentation
- How to Post on LinkedIn API With Python
- LinkedIn API with Python (Complete Guide)
- LinkedIn API: Authenticate Using OAuth 2.0
- LinkedIn API: Get User Information
- LinkedIn API: Get Your OAuth Credentials
- Authenticate the Twitter API with Python (Tweepy)
- How to Apply for a Twitter Developer Account
- How to get Twitter API Credentials (API Keys)
- Post on Twitter API using Tweepy and Python
- Tweepy Basics Functions for Twitter API (Python)
- Twitter API with Python (Complete Guide)
- Understand Tweepy’s Tweets JSON Response (Twitter API)
- Alert Robots.txt Changes to Slack using Python
- Get the Slack API Credentials (Webhooks)
- Send Message With Slack API and Python
- Slack API with Python (Complete Guide)
How to use WordPress REST API with Python (external)
Don’t stop there. APIs offer a lot of opportunities and once you get the hang of it, they become quite easy to implement.
There are many interesting open APIs available out there, please share any interesting work that you have done with an API with me.
SEO Strategist at Tripadvisor, ex- Seek (Melbourne, Australia). Specialized in technical SEO. In a quest to programmatic SEO for large organizations through the use of Python, R and machine learning.