Monday, 10 February 2020

API Calls


CRUD Operations in API Testing

C-Create-POST
R-Retrieve-GET
U-Update-PUT
D-Delete-DELETE

If we have two systems:

System1-Client-Consumer      >       System2-Server-Producer

System1 will call System2 and this call is HTTP Request. In the HTTP request we have:

1.URI
2.Headers
3.Payload

System2 will respond to the call of System1 and it is called HTTP Response. In the HTTP response we have:

1.Status-200OK
2.Response-Payload
3.String message-successful

Mainly there are four types of HTTP request in API testing.

1. POST call- Create an Account

HTTP request contains:

  • JSON/XML
  • Headers

It is used to create new entity.

2. GET call -Get an account by ID/Name

HTTP request contains:
 

  • URI
  • Path Parameter
  • Query Parameter
  • Headers

It is used to retrieve the data from server

3. PUT call -Update an account

Create +Update.It is used for Create and update a new entity

4. DELETE call-Delete an account

HTTP request contains:
JSON

It deletes the account in the server

Status Response Code


  • 200 ok
  • 201Created successfully
  • 400 Bad Request
  • 401 Unauthorized
  • 404 Not found
  • 500 servers’ internal error


HTTP Methods

  • GET
  • POST
  • PUT
  • DELETE


REST clients

Postman,SOAP UI,Advance Rest Client,JMeter,Browser
Postman is the most famous tool available in the market

URI

URI= URL(End Point URL)+Service URL

Go to the website https://reqres.in/

In postman we have to use URI


 Here’? ‘is the query parameter and 2 is the parameter value.it is used to filter the result.


This is path parameter for getting specific data.

Swagger

API documentation -it is a technical documentation

https://fakerestapi.azurewebsites.net/swagger/ui/index#!/Activities/Activities_Get


No comments:

Post a Comment