Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

357
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda