Duplicating Payload for use with Postman

Hi all,

Hope you are keeping well.

New to Postman, and payloads in general. I have the following code that I can use with a bulk endpoint to update user profiles:

{
"Operations":[
{
"method":"PATCH",
"path":"/Users/ID1",
"bulkId":"clientBulkId1",
"data":{
"schemas":[
"urn:scim:schemas:core:2.0:User"
],
"active":false
}
},
{
"method":"PATCH",
"path":"/Users/ID2",
"bulkId":"clientBulkId1",
"data":{
"schemas":[
"urn:scim:schemas:core:2.0:User"
],
"active":false
}
}
]
}

I already have a list of the users (a few thousand in total) ready to go.

Is there any tools you use to automate bulk creation of code like this and also pass each of the IDโ€™s? (such as using a variable).

Any help would be grateful.

Heya @douk87 !

If you have a list of user IDs that youโ€™d like to use in a bulk payload like the one you provided, there are a bunch of ways to generate this dynamically.

  1. Postman Scripts with External Data:

    • Postman supports running collections with a data file (like JSON or CSV). You can structure your request to use variables, and the values for these variables will be picked from your data file.
    • In your request body in Postman, replace the specific ID with a variable, like "path":"/Users/{{userID}}".
    • Use a data file with the structure:
    [
      {"userID": "ID1"},
      {"userID": "ID2"},
      ...
    ]
    
    • Then run the collection with the Runner, selecting the data file. Postman will iterate over each data point and replace the {{userID}} variable with the respective value.
  2. Node.js Script:

    • If youโ€™re comfortable with a bit of programming, you can write a simple Node.js script to generate the payload.
  3. Excel or Google Sheets:

    • If you have your user IDs in an Excel sheet or Google Sheets, you can use formulas to generate the JSON structure for each user ID. Once generated, you can copy and paste these into a JSON file.

Hope this helps! If you have other questions, let me know!

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