MS Club of SLIIT
Published in

MS Club of SLIIT

What is API?

API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message or check the weather on your phone, you’re using an API.

There are four different ways that APIs can work depending on when and why they were created.

  1. RPC APIs
  2. Websocket APIs
  3. REST APIs

What are SOAP APIs

These APIs use the Simple Object Access Protocol. Client and server exchange messages using XML. This is a less flexible API that was more popular in the past.

RPC APIs

These APIs are called Remote Procedure Calls. The client completes a function (or procedure) on the server, and the server sends the output back to the client.

Websocket APIs

Websocket API is another modern web API development that uses JSON objects to pass data. A WebSocket API supports two-way communication between client apps and the server. The server can send callback messages to connected clients, making it more efficient than REST API.

REST APIs

These are the most popular and flexible APIs found on the web today. The client sends requests to the server as data. The server uses this client input to start internal functions and returns output data back to the client. Let’s look at REST APIs in more detail below.

What are REST APIs?

REST stands for Representational State Transfer. REST defines a set of functions like GET, PUT, DELETE, etc. that clients can use to access server data. Clients and servers exchange data using HTTP.

The main feature of REST API is statelessness. Statelessness means that servers do not save client data between requests. Client requests to the server are similar to URLs you type in your browser to visit a website. The response from the server is plain data, without the typical graphical rendering of a web page.

What is web API?

A Web API or Web Service API is an application processing interface between a web server and a web browser. All web services are APIs but not all APIs are web services. REST API is a special type of Web API that uses the standard architectural style explained above.

The different terms around APIs, like Java API or service APIs, exist because historically, APIs were created before the world wide web. Modern web APIs are REST APIs and the terms can be used interchangeably.

What are the benefits of REST APIs?

REST APIs offer four main benefits:

1. Integration

APIs are used to integrate new applications with existing software systems. This increases development speed because each functionality doesn’t have to be written from scratch. You can use APIs to leverage existing code.

2. Innovation

Entire industries can change with the arrival of a new app. Businesses need to respond quickly and support the rapid deployment of innovative services. They can do this by making changes at the API level without having to rewrite the whole code.

3. Expansion

APIs present a unique opportunity for businesses to meet their clients’ needs across different platforms. For example, maps API allows map information integration via websites, Android, iOS, etc. Any business can give similar access to its internal databases by using free or paid APIs.

4. Ease of maintenance

The API acts as a gateway between two systems. Each system is obliged to make internal changes so that the API is not impacted. This way, any future code changes by one party do not impact the other party.

What are the different types of APIs?

APIs are classified according to their architecture and scope of use. We have already explored the main types of API architectures so let’s take a look at the scope of use.

These are internal to an enterprise and are only used for connecting systems and data within the business.

2. Public APIs

These are open to the public and may be used by anyone. There may or not be some authorization and cost associated with these types of APIs.

3. Partner APIs

These are only accessible by authorized external developers to aid business-to-business partnerships.

4. Composite APIs

These combine two or more different APIs to address complex system requirements or behaviors.

What are the different types of APIs?

APIs are classified according to their architecture and scope of use. We have already explored the main types of API architectures so let’s take a look at the scope of use.

1. Private APIs

These are internal to an enterprise and are only used for connecting systems and data within the business.

2. Public APIs

These are open to the public and may be used by anyone. There may or not be some authorization and cost associated with these types of APIs.

3. Partner APIs

These are only accessible by authorized external developers to aid business-to-business partnerships.

4. Composite APIs

These combine two or more different APIs to address complex system requirements or behaviors.

What is an API endpoint and why is it important?

API endpoints are the final touchpoints in the API communication system. These include server URLs, services, and other specific digital locations from where information is sent and received between systems. API endpoints are critical to enterprises for two main reasons:

1. Security

API endpoints make the system vulnerable to attack. API monitoring is crucial for preventing misuse.

2. Performance

API endpoints, especially high-traffic ones, can cause bottlenecks and affect system performance.

How to secure a REST API?

All APIs must be secured through proper authentication and monitoring. The two main ways to secure REST APIs include:

1. Authentication tokens

These are used to authorize users to make the API call. Authentication tokens check that the users are who they claim to be and that they have access rights for that particular API call. For example, when you log in to your email server, your email client uses authentication tokens for secure access.

2. API keys

API keys verify the program or application making the API call. They identify the application and ensure it has the access rights required to make the particular API call. API keys are not as secure as tokens but they allow API monitoring in order to gather data on usage. You may have noticed a long string of characters and numbers in your browser URL when you visit different websites. This string is an API key the website uses to make internal API calls.

How to use an API?

The steps to implement a new API include:

  1. Set up an HTTP API client. This tool allows you to structure API requests easily using the API keys received.
  2. If you don’t have an API client, you can try to structure the request yourself in your browser by referring to the API documentation.
  3. Once you are comfortable with the new API syntax, you can start using it in your code

references :

About WebSocket APIs in API Gateway

Choosing between REST APIs and HTTP APIs

What is API: Definition, Types, Specifications, Documentation

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Madhusha Prasad

Open Source Enthusiast | Full Stack Developer👨🏻‍💻 | JavaScript & Type Script , Git & GitHub Lover | Undergraduate — Software Engineering‍💻 | SLIIT👨🏻‍🎓