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

142
Views
Saving token is postman envvar automatically not working

API Response :

{
 "token" :"eyJ0eXAiOiJKV1QiLCfhfgJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImRiYWRtaW5AY2lkbnkub3JnIiwiZXhwIjoxNjMyNTY3OTY1LCJlbWFphbCI6ImRiYWRtaW5AY2gjglkbnkub3JnIiwib3JpZ19pYXQiOjE2MzI1NDk5NjV9.3ZtHRy0_jBao7hvQLSVcQuvIMIgjgjg7mmvKqlegS5Jo0-Q"
}

This is in Test

var res = pm.response.json();
pm.environment.set('env',token);

This is expected to save the token in env variable but the token did not work after saving.

What is the issue here?

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

0

Try this , it should work:

var res = pm.response.json();
pm.environment.set('env',res.token);

Basically the token you saved contained full response, not the token only.

about 4 years ago · Juan Pablo Isaza Report

0

var {token} = pm.response.json();
pm.environment.set('env',token);

You should access the property , you can access it by pm.response.json().token or by using destructure assignment

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!