Next question - I can call every single question with this request and depending on the response I can call the next one with the same request.
Iâm using this approach at the moment, but with many âNext questionâ POST requests.
My task is to call them with a single request.
How to do that using CSV file? The main thing is to check if every next question is the one that is expected.
Thatâs correct, Iâm sending a request and it comes back with a ânext question IDâ.
Here you can see my body every time:
{
âanswerBodyâ: {âvalueâ: â{{answerBody}}â}, - different every time
âanswerTypeâ: {{answerType}}, - can be the same or different
âanswerGroupIdâ: {{answerGroupId}}, - can be the same or different
âidâ: {{id}} - next questionâs ID (different every time)
}
So I need to repeat this until the last question. I also need to do it with a single request and using CSV file.
I hope itâs clear.
If I understood correctly, you need to take the id from response of your previous request and take other values from .csv file.
To do so you can update the environment or collection variable and set the questionId from there using test script. That value set can be used in next iteration. Rest values could be taken sequentially.
I am assuming, the response from the previous request looks as below.
{
âquestionIdâ: â1234567890â
}
Test Script will look like: pm.environment.set(pm.response.json().questionId,'id');
In the above example, I have used environment variables, you may use global or collection based on the requirement.
This variable value will be accessible in the next run as now I have set to the environment. Once the run is completed it will update the value, that could be fetched from response of the request.