Hello, I’m totally new to test automation in postman.
What I wanted to do:
I call POST endpoint which returns only session-id in JSON format:
In the Tests section, I wanted to save this session_id as an environment variable to use it as a header in next endpoints:
var jsonData = JSON.parse(responseBody); pm.environment.set("SessionId", jsonData.session-id);
SessionId - is the name of the environment variable which I added earlier.
But after calling the endpoint, code in Test section fails with this error:
ReferenceError: id is not defined
And I’m not sure how to change it to get the result I want.