1

Here is the response i'm getting from my request :

<?xml version="1.0" encoding="UTF-8"?>
<session id="147xxxx"/>

I added this code to the tests tab of my request :

var XMLData = xml2Json(responseBody);
sessionId = pm.response.text("sessionId");
pm.environment.set("sessionId", sessionId);

It seems to work but all i'm getting is the entire response in my environment variable which is this :

<?xml version="1.0" encoding="UTF-8"?>
<session id="147xxxx"/>

But i only want the id in my environment variable.

Any ideas on how i could do this?

VLAZ
  • 26,331
  • 9
  • 49
  • 67
Christophe
  • 63
  • 5
  • Does this answer your question? [How do I extract a variable from XML using Postman?](https://stackoverflow.com/questions/36815414/how-do-i-extract-a-variable-from-xml-using-postman) – OldProgrammer Oct 22 '22 at 18:41
  • Saw this post already and tried the proposed solutions but none of them worked – Christophe Oct 22 '22 at 18:46

0 Answers0