Reputation: 23
I currently have one collection in Postman, with two folders. First folder has two POST request.
Now, I wanna combine these both so I don't have to run two requests? Is there any way I can do that on Postman? Any help would be great! :)
Upvotes: 1
Views: 1088
Reputation: 25901
Could you make use of the pm.sendRequest()
function inside the Tests
tab to fire off a request to see if the file has been uploaded?
This is the example snippet you would get in the application:
pm.sendRequest("https://postman-echo.com/get", function (err, response) {
console.log(response.json());
});
Some more usage examples can be found here: https://gist.github.com/madebysid/b57985b0649d3407a7aa9de1bd327990
Upvotes: 1
Reputation: 99618
Generally calling an API requires a HTTP request. If you want to make less requests, the service you are using needs to define a special API that does both things at once.
If the service you are using does not have an API specifically for that purpose, then you will need to make 2 requests.
The question I would ask myself is: Why do I care if there are 2 requests instead of 1. And if there's a reason why that's a problem for me, is there another way I can solve that problem.
Upvotes: 0