Hi,
I am sending a request and it returns few records in response and it is displayed in page 1. I have multiple pages of response. After getting the first page response, i am printing the request body using “console.log(JSON.stringify(pm.request));” and copying it from the console and using it in pm.sendRequest() function to run the request inside a for loop. I want to pass a different page number to the request for every run inside the loop.
Below is my request body:
{“url”:{"hidden intentionally},
“header”:[hidden intentionally],
“method”:“POST”,
“body”:{“mode”:“graphql”,“graphql”:
{“query”:“query ($start: String!, $end: String!, $page: Int!) \r\n{\r\n itemClassUpdates(start: $start, end: $end, page: $page) \r\n {\r\n page\r\n totalPages\r\n start\r\n end\r\n events \r\n {\r\n event\r\n itemClass\r\n {\r\n handle\r\n code\r\n erpCode\r\n description\r\n discontinued\r\n createUser\r\n createDate\r\n updateUser\r\n lastModified\r\n itemSubclasses\r\n {\r\n handle \r\n classHandle\r\n code\r\n erpCode\r\n description\r\n defaultUnitHandle\r\n discontinued\r\n createUser\r\n createDate\r\n updateUser\r\n lastModified\r\n }\r\n }\r\n }\r\n }\r\n}”,
“variables”:"{\r\n “start”: “2020-08-13T13:28:10Z”,\r\n “end”: “2020-08-13T13:55:18Z”,\r\n “page” : 1\r\n \r\n}"},
“options”:{“graphql”:{}}
}
}
Is this possible to send dynamic page numbers through pm.sendRequest function into page variable in postman?