Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

262
Views
Set environmental variable in Postman when there's no variable key being set

postman screenshot

I'm trying to make this uuid being set as an environmental variable after it is returned by the method. However, in the response, the method returns String only (uuid), without any variable key. I'm a total noob and tried something like:

var jsonData = pm.response.json();
pm.environment.set(String, jsonData.invitationId);

I have no idea what should I provide in the place of variable_key. Whatever I do, in the Test Results console I get errors like:

Unexpected token 'd' at 1:1 d7723dd8-31c5-40fc-a3a4-5c8a497d2280 ^

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The screenshot shows that the response is 'text' format not json

You want to save the response as text:

var res = pm.response.text();
pm.environment.set("UUID_1", res)

If you have multiple UUIDs in a response like:

c7428a7c-48b5-4636-a4c4-2c4eee71cd57
b7428a7c-58b5-3636-b4s4-1c4hgd71ad45
a7428a7c-68b5-2636-c4e4-ac4lts71ef89

then you can split them like this

var res = pm.response.text();
pm.environment.set("UUID_1", res.split("\r\n")[0])
pm.environment.set("UUID_2", res.split("\r\n")[1])
pm.environment.set("UUID_3", res.split("\r\n")[2])
about 4 years ago · Juan Pablo Isaza Report

0

The String in the 2nd line is the error i guess. It should be a variable like below:

var url = pm.request.url;
var id = /[^\/]*$/.exec(url)[0];
pm.environment.set('testId', id);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!