- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to change the workflow in Postman?
In a Collection, the requests are executed in the sequence in which they are created. However, a workflow can be changed in Postman. To illustrate it, let us take a Collection having four requests.
To trigger that Collection, click on the arrow appearing to the right of the name of the Collection in the sidebar. The Run button appears, click on it.
The Collection Runner window gets launched. Within the RUN ORDERsection, the sequence in which the requests shall get executed is displayed from the top to bottom. In our example, the order is −
GET
POST
PUT
DEL
Click on Run Collection1.
A new window appears containing the execution details. With the workflow as −
GET – Executed first.
POST – Executed second.
DEL – Executed third.
PUT – Executed last.
Let us try to execute the requests in the order given below −
GET – To be executed first.
POST – To be executed second.
PUT – To be executed third.
DEL – To be executed last.
This change in workflow can be achieved using the function postman.setNextRequest(). It is used to point to the next request to be run. The name of the next request to be executed is passed as a parameter.
Syntax −
postman.setNextRequest("next request name")
The steps to change a workflow are listed below −
Step1 − Incorporate the below script for the Create User request under the Tests tab,
postman.setNextRequest("Update Request")
Step2 − Incorporate the below script for the Update Request under the Tests tab,
postman.setNextRequest("Delete Request")
Step3 − Incorporate the below script for the Delete Request under the Tests tab,
postman.setNextRequest(null)
Step4 − Trigger the collection – Collection1 for execution.
Step5 − A new window opens showing the new sequence of request execution as given below:
GET – executed first.
POST – executed second.
PUT – executed third.
DEL – executed last.
- Related Articles
- How to handle Infinite loops in Postman Workflow?
- How to run Invoke-Command in PowerShell Workflow?
- How to clear the global variables in Postman?
- How to Import Collection in Postman?
- How to Monitor Collections in Postman?
- How to use Sessions in Postman?
- How to Manage Cookies in Postman?
- How to Add Cookies in Postman?
- How to create sessions in Postman?
- How to parameterize requests in Postman?
- How to get the details of a workflow using Boto3
- How to Generate API Documentation in Postman?
- How to use dynamic GUID in Postman?
- How to run Collection Runner in Postman?
- How to Create an Environment in Postman?
