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

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

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 Denunciar

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 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