# Pass the payload on query parameters in Endpoint URL

**URL:** <https://community.postman.com/t/pass-the-payload-on-query-parameters-in-endpoint-url/57507>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [February 9, 2024, 4:50pm UTC](https://community.postman.com/t/pass-the-payload-on-query-parameters-in-endpoint-url/57507 "2024-02-09T16:50:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ganesh2183](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@ganesh2183](https://community.postman.com/u/ganesh2183)\
**Post date:** [February 9, 2024, 4:50pm UTC](https://community.postman.com/t/pass-the-payload-on-query-parameters-in-endpoint-url/57507/1 "2024-02-09T16:50:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [February 10, 2024, 11:24am UTC](https://community.postman.com/t/pass-the-payload-on-query-parameters-in-endpoint-url/57507/2 "2024-02-10T11:24:17Z")

</div>

Hey @ganesh2183 👋

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.

---

<div class="post-metadata">

**Author:** ![ganesh2183](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@ganesh2183](https://community.postman.com/u/ganesh2183)\
**Post date:** [February 12, 2024, 12:29pm UTC](https://community.postman.com/t/pass-the-payload-on-query-parameters-in-endpoint-url/57507/3 "2024-02-12T12:29:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [February 12, 2024, 2:46pm UTC](https://community.postman.com/t/pass-the-payload-on-query-parameters-in-endpoint-url/57507/4 "2024-02-12T14:46:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ganesh2183](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@ganesh2183](https://community.postman.com/u/ganesh2183)\
**Post date:** [February 19, 2024, 11:33pm UTC](https://community.postman.com/t/pass-the-payload-on-query-parameters-in-endpoint-url/57507/5 "2024-02-19T23:33:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [February 20, 2024, 11:54am UTC](https://community.postman.com/t/pass-the-payload-on-query-parameters-in-endpoint-url/57507/6 "2024-02-20T11:54:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [March 21, 2024, 11:54am UTC](https://community.postman.com/t/pass-the-payload-on-query-parameters-in-endpoint-url/57507/7 "2024-03-21T11:54:14Z")

</div>

Closed on March 21, 2024, 11:54am UTC

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