Workflows in Postman
POSTMAN workflow is the order of request execution within a collection. When you run the collection directly, then the requests are either executed randomly or executed serially. But we can also set the priority of the request, and we can also choose the order of execution of request means we can set which request should be executed when. This feature is called workflow in Postman.
Postman provides a feature to control the workflow of requests in the collection, and the feature is called Collection Runner (or Runner).
Once a request is executed by the collection runner, all requests within the collection are executed, but there is a pattern in which all requests are executed. Postman provides many inbuilt algorithms to decide in which pattern the request has to be run.
Order of Execution of Collection Runner
Generally, the collection runner runs the request in sequential order. Some APIs requires to send request one by one; means, the second request that can execute only after the first request has completed and the third request will wait for the response of the second request. And so on.
In this case, the default request execution in the collection runner is fine, as there is no requirement to run the requests parallelly, or no random request has to be run.
But there may be cases where one API request can be dependent on two or more different API response. Or there may be another situation where a particular API request which is in the middle of the APIs request execution queue, have to get executed for different request randomly.
In this case, the sequential execution of the request in the collection runner will not be useful. We should have to create a workflow and inform the collection runner that, which requests to execute when. This task can only be done by calling an API request. This is called an API call.
An API call means calling an API for its execution in a user-defined manner.
Default Workflow in Postman
Let’s see how the normal request execution workflow runs in default.
- Create a collection and give the name of the collection. Here my collection name is “Default Workflow.”
- Add three requests in the collection and name it as Request 1, Request 2, Request 3.
- Three requests are:
Add the following URL in-
Request 1: www.tutoraspire.com
Request 2: www.google.com
Request 3: www.facebook.com
- Now you have three different requests in a collection. Run the collection runner now.
Select the Runner (Collection Runner) menu from the top of the postman window. It will open a new window.
- Choose your collection.
- Run the collection to see all the iterations, orders, environments, etc. for the collection.
Now in the above image, you can see the request is sent sequentially. It starts with the Request 1, and then continues to Request 2 and then Request 3. This means it is running sequentially.