Good afternoon
I am sending a GET request {{base_url_zakaz}}abonents/v0/abonents?Inn=5534183182&Kpp=553401001
In order to remember the variables, abonentId and requisiteId, received in response to this request. I write down 2 scripts in the Post-Response Script tab:
However, at the same time, in the “Environment Quick Look” tab. For some reason, Postman does not remember the variables received in the body of the response to the request.
In this case, in each of the variables, abonent_Id and requisite_Id, the value is null as the Current Value.
Question: What am I doing wrong and specifying in the request, which is why the specified variables are not being remembered?
It’s an array, with an object inside it. Directly going to the abonentId property would result in it being undefined. You need to first specify which object within the array, you want to access.
The Postman Console is your friend here, you can use this to see what would be the result if you were to reference things in certain ways.
This is an example of what you’re doing vs accessing the object first:
I’ve previously shared this with you in a different thread but this will hopefully explain again how to extract different pieces of data from a response body: