Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
Geting specific response body from response and put in a variable in Postman

I am trying to set the response in a variable but the response is just an ID, not an object. I used

var resposseBody=pm.response.json(); 

or

var resposseBody=pm.response.text();

but they didn't work. How can I set the response below in a variable?

"3707ff3d-2af9-4ea1-a6aa-08d9a8ee3cb3"

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

To save that value to a variable, add this to the Tests script:

pm.globals.set('id', pm.response.text());

This is an example using the global scope but the variable can be set at the Environment or Collection level.

There aren't many details in your question so it's difficult to offer any more of a solution than this one.

about 4 years ago · Juan Pablo Isaza Relatório

0

If the response is in json format, like

{"id":"3707ff3d-2af9-4ea1-a6aa-08d9a8ee3cb3"}

then you can get simply with

responseJsonData=pm.response.json();
responseId=responseJsonData.id;
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda