New to postman and REST, can you help?

Hi @codythesailpointpost,

It’s not super complicated at all, as the process is repetitive and shouldn’t require different logic, unless there are error cases that need to be handled.

Sounds like having 600 different IDs means automation would be better. However, you don’t have to use a new variable for a new ID every time, you can reuse the old variable. Difference now would be persisting the ID with the response you are looking for.

Sounds like Newman should do you justice. Actually, @vdespa just made a great video on how to read, and write to a CSV in a Postman test. This is semi advanced, but I find it would be a great long term goal for you, given how many IDs you have.

In the mean time, you can easily do this manually(ish) do this with the following in your Tests section of your request:
pm.environment.set("id", pm.response.json()["id"])

This should roughly get the variable you are looking for, depending on structure of the json.

Then, you can use that variable in another postman request using the following syntax:
{{api-url}}/cc/api/role/get?id={{id}}

Then you can save the output using the following syntax in your Tests script for the second request that uses the ID, similar to the above:
pm.environment.set("displayName", pm.response.json()["key"]["displayName"])
pm.environment.set("property", pm.response.json()["key"]["property"])
pm.environment.set("value", pm.response.json()["key"]["value"])

Something like this should suffice to start.

Let me know if this helps!

Orest

2 Likes