thunder-client-support icon indicating copy to clipboard operation
thunder-client-support copied to clipboard

Is there a way to get and set the data through script in collection run?

Open mrmaramreddy opened this issue 2 years ago • 4 comments

Question: Is there an equivalent of postmanpm.iterationData.get or pm.iterationData.set in TC to set or get values from csv when running a collection?

Are you using the free version/paid version/trial: Free

mrmaramreddy avatar Nov 14 '23 03:11 mrmaramreddy

No we don't have similar API in TC

rangav avatar Nov 14 '23 06:11 rangav

Can you please share your use-case and examples, We will review and add to the roadmap.

rangav avatar Nov 14 '23 12:11 rangav

My use case is,

  1. Create a csv file with user-friendly names.
  2. Fetch these user-friendly names during "collection run" and parse the API response to fetch the corresponding id (lengthy and not user-friendly) for the respective user-friendly name.
  3. Use the id fetched in step 2 in next API call which is part of the collection.
  4. Repeat this process for all rows in the csv.

mrmaramreddy avatar Nov 14 '23 15:11 mrmaramreddy

Thanks for sharing the use cases, Will review it.

rangav avatar Nov 15 '23 14:11 rangav

please try below methods

  • pm.iterationData.get ----> tc.getVar
  • pm.iterationData.set ----> tc.setVar

rangav avatar Apr 25 '24 05:04 rangav