L
L
LetSonicX2021-04-05 15:43:08
API
LetSonicX, 2021-04-05 15:43:08

How to step by step pull data from an array into json and add it to the next request?

Question about working in Postman.
There is a POST request by which I get a JSON like this:

{
    "parameter": [
        {
            "value": [
                {
                    "code": "123", 
                },
                {
                    "code": "124",
                }
                ]
}

After that, I use code in the following request:
GET url/get_resource?_format=json&code={{variable}}

I know how to take a specific value and automatically insert it into the following request:
var jsonresponse = pm.response.json().parameter[ 0].value[1].code
pm.globals.set("variable",jsonresponse)

Question: Is it possible in Postman to go through the entire array of received json according to the following algorithm:
1. Get json, take code[0], we automatically go to the next GET request, insert the received value there.
2. We get code[1] by automatically passing to it, the variable is updated to this value, GET is performed, and so on until the end of the array.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question