Join data from a file

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