Monday, February 13, 2023

what is API ? In a easy language

 API stands for the Application Programming Interface, They are basically a collection of functions and procedures which allows us to communicate two application or library.


For example : 

It like a connector as seen in the picture. All data connects to our organization through API.






In one line, API is its an interface between different software programs or service.


Restaurant API example:


API is the messenger that takes your order(waiter) and tells the system(kitchen) what to do (to prepare food) and in return gives back the response you asked (waiter returns with the ordered food).

Types of APIs 


we are only concern about the Web API 

Simple Object Access Protocol ( SOAP )
Remote Procedure Call (RPC)
Representational State Transfer (REST)


what is API ?

API testing is testing that APIs and its integration with the services

In this guide, we are basically discussing about the REST API Testing. Where we need to test the REST APIs for the validation, error codes and load testing.

What is REST API ?

As REST is an acronym for REPRESNTATIONAL STATE TRANSFER, statelessness is key. An API can be REST if it follows the below constraints.

The REST architecture style describes six constraints:

1. uniform interface 2. stateless 3. cacheable 4. client server 5. layered system 6. code on demand.

Uniform interface : Uniform interface constraint defines the interface between clients and servers.

In other terms : First constraint of the REST API states that the client and server has to communicate and agree to certain rules based on resources (they should communicate with same resource like json, xml, html, txt) and with proper encoding like UTF-8 extra.

Another point they should communicate with the self-descriptive Messages e.g: Use the same MIME types.

Stateless

APIs in REST are stateless and Client and Server does not worry about the state of the request or response.


cacheable

According to the WWW, clients can cache responses. Responses should therefore, implicitly or explicitly, define themselves as cacheable, its upto server when they want the cache to expired etc.

Client-server

Client and server are two different entity, it means that servers and clients may also be replaced and developed independently as long as the interface is not altered.

Layered system

It  means that the between client and server there can be any number of layered systems it does not matter.

Code on Demand 

Server can store the code or logic to themselves and transfer it whenever needed rather client side logic.


No comments:

Post a Comment