Application Programming Interface(API)

Riya Jain
3 min readSep 5, 2023

An API is a communication interface that allows two separate software components to share data Eg. weather example, the bureau’s weather database is the server, and the mobile app is the client, The weather app on your phone “talks” to this system via APIs and shows you daily weather updates on your phone.

What are the different types of APIs?(depending on scope)

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

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.

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

Composite APIs: These combine two or more different APIs to address complex system requirements or behaviors. Rather than multiple round trips to a server, a client can make one API request with a chain of calls and receive one response.

Diff ways API works: Before starting with differentiating how Rest and Soap works, here’s a Martin Lawrence reference:

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.

Statelessness means that servers do not save client data between requests. A request is sent from client to server in the form of a web URL as HTTP GET or POST or PUT or DELETE request. After that, a response comes back from the server in the form of a resource which can be anything like HTML, XML, Image, or JSON.

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

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

GraphQL : A query language that was developed specifically for APIs. It prioritizes giving clients exactly the data they request and no more. It is designed to make APIs fast, flexible, and developer-friendly. As an alternative to REST, GraphQL gives front-end developers the ability to query multiple databases

Organizations choose to build APIs with GraphQL because it helps them develop applications faster.

REST is good for simple data sources where resources are well defined. GraphQL is good for large, complex, and interrelated data sources. REST has multiple endpoints in the form of URLs to define resources. GraphQL has a single URL endpoint.

Thanks for taking out time to read this! Do Clap if you liked it. See you next time!

Till then do connect with me on Linkedin.

--

--

Riya Jain

Security Researcher | Penetration Tester | Red Team | Blue Team | eJPT|CAP | CND | Purple Team