filmov
tv
Postman Tutorial - Chaining API Requests in Postman

Показать описание
Learn how to chain different API Requests in Postman.
While working with API Requests, every Request may not have all the required information and it requires some additional data from the previous requests. So we need to find a way of passing data from one request to another in Postman.
Since we already created a random value for the repository name, we can use that variable {{repoName}} in all the subsequent API requests wherever required. This is one way of generating data in one Request and using it in other requests.
To demonstrate further, we will use another API Request which will be used for Deleting a Repository in our Github Collection. It accepts two path variables - Repository Name and Owner Name. One of the variable can be replaced with the previously generate random value. For Owner name we will go back to our Post Request which creates a new Repository. Owner name is available in the response body of the request.
We will retrieve the value of the owner name from the response body and assign it to an environment variable. This can later be used in the Delete Repository Request Path Variables. It can be done by adding the below script in the Tests section:
var json = JSON.parse(responseBody);
Path Variables in Delete Request:
owner: {{owner}}
repo: {{repoName}}
Now if run all the requests in our collection in multiple iterations, the complete workflow of creating a repo, getting the repo and deleting it will work seamlessly.
Found this video interesting - Please Like and Share the video.
Have Feedback/Questions - Leave a comment below.
Get access to 100 plus videos on different automation tools. Also never miss out on any new video posted on our channel.
Other Video Playlists on our Channel:
Selenium:
Jenkins 2.0:
Maven:
While working with API Requests, every Request may not have all the required information and it requires some additional data from the previous requests. So we need to find a way of passing data from one request to another in Postman.
Since we already created a random value for the repository name, we can use that variable {{repoName}} in all the subsequent API requests wherever required. This is one way of generating data in one Request and using it in other requests.
To demonstrate further, we will use another API Request which will be used for Deleting a Repository in our Github Collection. It accepts two path variables - Repository Name and Owner Name. One of the variable can be replaced with the previously generate random value. For Owner name we will go back to our Post Request which creates a new Repository. Owner name is available in the response body of the request.
We will retrieve the value of the owner name from the response body and assign it to an environment variable. This can later be used in the Delete Repository Request Path Variables. It can be done by adding the below script in the Tests section:
var json = JSON.parse(responseBody);
Path Variables in Delete Request:
owner: {{owner}}
repo: {{repoName}}
Now if run all the requests in our collection in multiple iterations, the complete workflow of creating a repo, getting the repo and deleting it will work seamlessly.
Found this video interesting - Please Like and Share the video.
Have Feedback/Questions - Leave a comment below.
Get access to 100 plus videos on different automation tools. Also never miss out on any new video posted on our channel.
Other Video Playlists on our Channel:
Selenium:
Jenkins 2.0:
Maven:
Комментарии