Conditionally update one field based on the value of another

I have a request to use existing REST APIs to update a field based on the value of another field. E.G.
If “Status” = “High” Set “Priority” = '1"
Else If "Status = “Normal” Set Priority = 2
Else Set “Priority” = “3”

Can this be done in one Patch operation using query parms/varibales?
Or would it be better to somehow use results of a “GET” to feed multiple "PATCH"s?

Hope this makes sense?

Hi @keith1990. Welcome to the Postman Community.

Postman allows you to build a workflow with different requests in a collection. The most straightforward way is to do this using two different requests.

After the first request, you can store the needed value in an environment or collection variable using Postman Scripts in the scripting tab.

These variables can be used in the request body, query or path parameters of your next request.

Ensure you run your requests using the collection runner so that they run sequentially immediately after one another.

Thank you so much @gbadebo-bello - You got me off to a great start. Still lots to learn but I got this conditional update working using collection variables.

This following thread was very helpful too, if anyone else is in my situation:

Happy to hear that, @keith1990!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.