I have store the below result in a environment variable called Key_value and want to retrieve the Id value from this variable and used it in the next post request. Can some one help me how to achieve the same.
I have used the above script in the pre request part of post request and i am using body as mentioned below and it is throwing error here Id is the value retreived from above scripts . i have to use the value “9yQeoXHnw0ykkfKz5zzZCL” in my body of next request which is what i am expecting in the {{id}} value.
For you to use the extracted value of id in the body of the request, you would need to set the value of id to an environment or global variable as given below and then access it using the double brackets in the request:
key = JSON.parse(pm.environment.get("Key_value"));
pm.environment.set("id", key.objects[0].id);
or
pm.globals.set("id", key.objects[0].id);