Pass the payload on query parameters in Endpoint URL

I want to pass the payload to query parameter values in endpoint URL from csv file in runner. I donโ€™t want to use variable on query parameter as {{payload}} in URL

Need help on pre-request script to identify the query parameters and pass the payload one by one on each payload location (query parameter). For example the URL has 4 query parameters i want to pass on each query parameter one by one on every request.

Hey @ganesh2183 :wave:

Are you able to expand on the different parts of that flow, please?

If you can post them, screenshots would be very useful to help see what youโ€™re trying yo achieve.

Thanks for the reply.

Looking for Pre-request test script for payload injection on query parameters in endpoint URL using CSV file in collection runner. Inject the payload one by one in each payload location (query parameter), For first request update the payload on first query parameter then update payload on another query parameter on next request, same for other query parameters.

CSV file data:
payload (column name)
admin
user
test
test123

You would just have four requests in a collection or folder.

One for each of the query parameters.

stateAbbreviation, channel, bank and racfId.

You will then have the {{payload}} variable from the CSV in the correct query parameter.

Or update your CSV, so it has details for all four query parameters on each line.

No need for extraneous scripting in either of those methods.

My recommendation would be to have a CSV file with all four query parameters as headers.

@michaelderekjones Is there the way to do the same using pre-request script / test script instead of having four requests in collection or folder?

You could probably get this in a pre-request script, but its a lot of code, when all you really need to do is structure your CSV file correctly instead.

Feel free to try it and post what youโ€™ve attempted. Iโ€™m not sure anyone here will write that code for you.

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