DEV Community

Cover image for API Integration: Request and Response
Nitish Prajapati
Nitish Prajapati

Posted on

API Integration: Request and Response

WHAT IS API?

API Stands for Application Programming Interface.API enables interaction with Data, Application, and Services. API delivers data between devices and programs. Using API we access the Data in Request and Response format. That's all for API now let's talk about the working

WORKING OF API's

API Integration needs to be Done for the working of APIs.

STEP'S:-
First of all the Response from APIs are in JSON(Javascript Object Notation) format and the Same format is used for Request.
In the Application, the Request Headers and Request Body are Constructed for Accessing the Details Device from Where the Request is Send. So at the End Point, the Server knows from where the Request is Generated.

Request Body in C#:-
  namespace Request_Body
{
  public class Request_class_name
  {
   //Details
  }
  public class Main_Request_Body
  {
   //Details
  } 
  public class Request_Body
  {
   //Details
   //Request Body
   //Request Header
  } 
  public class Request_Root
  {
   //Details
  }

}
Enter fullscreen mode Exit fullscreen mode

That is the Request Body for Sending Request to API

This API Request with the Help of Request Header and Request Body is Send to ESB(Enterprise Service Bus) Path where the Response is Generated where the Endpoint is Hit and Response is Send Back to Device

The request is Converted into JSON format from Object Format this is an Important Step which needs to be Done Carefully.

After getting a response from ESB we Need to store in Response Body

Response Body in C#:-
  namespace Response_Body
{
  public class Response_class_name
  {
   //Details
  }
  public class Main_Response_class_name
  {
   //Details
  } 
  public class Response_Body
  {
   //Details
   //Response Body
   //Response Header
   //Status 
  } 
  public class Response_Root
  {
   //Details
  }

}
Enter fullscreen mode Exit fullscreen mode

Here Status Shows whether the Request is Valid or What is Output of the Request and Accordingly, we need to need to Display the Output of the Status.

So with Help of Request Body and Response Body APIs Integration can be done.

Postman is a great tool we can use for Checking if the APIs are Hitting the server Properly or Not.

That's all we Generally use for API Integration.

Top comments (0)