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

352
Views
How to use {{$randomInt}} in request body and save it in environment

I am trying to generate a random number using {{$randomInt}} and writing this script in pre-request script to get and set the value in an environment

let rand_int = pm.variables.replaceIn('{{$randomInt}}')
pm.environment.set("rand_int", rand_int)

But I want to use {{$randomInt}} directly in the body and store the value directly in the environment from the request body. Is there any way to do it?

Suppose this is my request body. When I send the request I want to auto-set that random value in the environment.

{
   "gårdsnummer": {{$randomInt}}
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When you're using an environment variable in the body of the request you don't need or shouldn't use the $. The following should work:

{
    "gårdsnummer": {{rand_int}}
} 
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!