Hello
I have some data that looks like
{
âuniqueIdâ: 1
âusernameâ: âjohn.doeâ,
âpasswordâ: âunknownâ,
âemailâ: âunknownâ
}
and Iâd like to update those âunknownsâ with actual data which I have managed to do manually by sending a put request so I know itâs all able to be done.
I currently have around 2000 unknowns and it is increasing so Iâd like to automate this. I have a file, currently saved as json (but I have also tried a csv file) that contains many many rows that will look like
{
ânameâ: âjohn.doeâ,
âsecretpasswordâ : âsomethingâ,
âemailaddressâ : âjohn.doe@mycompanyâ
}
Iâve attempted to use postman echo to save the csv/json file, but Iâm really struggling on how I then can use this to join to my actual data.
Iâve got as far with my actual data to loop through each uniqueId and then set the data to whatever variables it can, but itâs just getting the variables to join which Iâm struggling with.
Is this even possible? Iâm still really new so apologies if it doesnât make sense
1 Like
Hi @altimetry-astronaut4
Welcome to the Postman community. This sounds like an interesting use-case, and yes this is totally possible with Postman.
What comes to mind first when tackling this is thinking about writing Scripts.
These scripts can be written in a Pre-request, as well as in the Test script
Intro to Scripts : Scripting in Postman | Postman Learning Center
Pre-Request Scripts : Writing pre-request scripts | Postman Learning Center
Test Scripts : Writing tests | Postman Learning Center
In this scenario, it sounds like you are trying to change the unknown value with something dynamic.
One flow I would consider is having that PUT request send some data to an environment variable and then write a script to send that data to the API dynamically.
Some resources on working with variables : Using variables | Postman Learning Center
Some resources on working with dynamic requests: Dynamic variables | Postman Learning Center
Here is an example of dynamic requests with 30 days of Postman . On day 25 you will see an example of how you can go about working with these types of requests.
https://www.postman.com/postman/workspace/30-days-of-postman-for-developers/documentation/1559645-2f480c99-4608-4210-b3c5-5a75c7e7a384
Thank you so much for all of your input. Iâve read through lots of documentation you provided, but still struggling.
I think the bit where I have the most issue is storing all the responses from the csv to then join them, Iâm currently using the collection runner, but not quite sure I understand how that then creates the data I need.