Hello All,
Greetings!!.
I am trying to correlate the response of a GET request & set it as an environment variable. Unfortunately I am not able to capture the response & getting “There was an error in evaluating the test script: JSONError: Unexpected token ‘e’ at 1:1” error.
Please find more details below.
GET method
Content-Type:application/json
ref screenshots:
I had tried the below snippets.
1)
var jsonData = JSON.parse(responseBody);
pm.environment.set(“auth_token”, jsonData.json().val);
console.log(“auth_token created”);
var auth_token= JSON.parse(responseBody);
pm.environment.set(“auth”,auth_token);
var jsonData = JSON.parse(responseBody);
pm.environment.set(“auth_token”, jsonData.responseBody);.
Any suggestions would be helpful.
Thanks in Advance.