API

API

What is an API?

Since we're talking about REST APIs, our definition of an API will not go beyond the scope of the web.

API stands for Application Programming Interface. An API establishes a connection between programs so they can transfer data.

A program that has an API implies that some parts of its data is exposed for the client to use. The client could be the frontend of the same program or an external program.

In order to get this data, a structured request has to be sent to the API. If the request meets the desired requirements, a response which contains the data gets sent back to where the request was made. This response usually comes in the form of JSON or XML data.

In some cases, you'll need some sort of authorization to gain access to external API data.

Every API has documentation that tells you what data is available and how to structure your request in order to get a valid response.

API Example

Was that confusing?

Imagine visiting a new restaurant. You're there to order food, and since you haven't been there before, you don't exactly know what type of food they serve.

The server then approaches you with a menu so you can pick what you'd like to eat. After making your choice, the server then goes to the kitchen and gets your food.

In this case, the server is the API who is connecting you to the kitchen. The API's documentation is the menu. The request is made when you pick what you'd like to eat, and the response is the food being served.

I hope that helps you understand what an API is and how it works.

What is REST?

REST stands for Representational State Transfer. It is a standard that guides the design and development of processes which enable us to interact with data stored on a web server.

The above definition may not look as complex or "professional" as the ones you come across on the internet, but the goal here is for you to understand the basic purpose of REST APIs.

An API that complies with some or all of the six guiding constraints of REST is considered to be RESTful.

We are able to communicate with servers using the HTTP protocol. With these protocols, we can Create, Read, Update and Delete data – otherwise known as CRUD operations.

But how can we perform these CRUD operations and communicate with data on the server?

We can do this by sending HTTP requests, and that is where REST comes in. REST simplifies the communication process by providing various HTTP methods/operations/verbs which we can use to send requests to the server.

How to communicate with a server using REST APIs

As we discussed in the last section, REST APIs make the communication process with the server easier for us by giving us various HTTP request methods. The most commonly used methods are:

  • GET: The get method is used to Read data on the server.
  • POST: The post method is used to Create data.
  • PATCH/PUT: The patch method is used to Update data.
  • DELETE: The delete method is used to Delete data.

To view or add a comment, sign in

More articles by NISHI KUMARI

  • What is Parquet?

    Apache Parquet is an open source, column-oriented data file format designed for efficient data storage and retrieval…

  • Spark Session vs. Spark Context

    In Apache Spark, an entry point is the gateway to its distributed computing capabilities, connecting your application…

  • What Is Basel III?

    Basel III Endgame is the last stage of U.S.

  • What Is Fraud Detection?

    Fraud detection using machine learning involves using AI algorithms to analyze data and identify patterns that suggest…

  • What is Anomaly Detection?

    Anomaly Detection, additionally known as outlier detection, is a technique in records analysis and machine studying…

  • What Are Performance Metrics?

    Performance metrics are data and calculations that businesses use to track activities, behaviors and capabilities…

  • What is Model Validation and Why is it Important?

    The process that helps us evaluate the performance of a trained model is called Model Validation. It helps us in…

  • Automation Testing

    What is Automation? Before starting with Automation Testing, let’s first understand the term – “automation”. Automation…

  • Programmer Analyst

    A programmer analyst is a professional who combines the roles of a programmer and a systems analyst. They are…

  • What is Treasury Data Analytics?

    Treasury data analytics is the practice of using data analysis techniques to gain insights into a company’s treasury…

Insights from the community

Others also viewed

Explore topics