Why are specified variables not being remembered?

Hey @spacecraft-engineer2 :wave:

The is down to the references that you’re making to that response data:

[
    {
        "abonentId": "2202db26-15cb-4abc-a33b-997f966e8043",
        "requisites": {
            "requisiteId": "3a44b0c9-cc36-41d9-9fa2-9578f139e9bd",
            "inn": "5534183182",
            "kpp": {
                "value": "553401001",
                "organizationKppType": 1
            },
            "clientType": 1,
            "name": "LLC Organization Name"
        },
        "accounts": []
    }
]

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:

console.log(pm.response.json().abonentId)
console.log(pm.response.json()[0].abonentId)


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:

1 Like