My question:
I have 2 collections.
In C1 I send a request to get the response value of “access_type” and set its value in the Collection variable “CollRefToken”.
This works fine. every time I POST the request, the current value of CollRefToken is being updated. The Code to set the CollVar is under “Tests” in the POST request.
In C2 I want to do the same. Same code, but here the Collection variable is not being updated. The request runs without error in both collections.
Details (like screenshots):
Collection 1 (CollRefToken is being updated)
let jsonResponse = pm.response.json();
console.log(jsonResponse);
pm.collectionVariables.set("CollRefToken", jsonResponse.access_token);
{
"access_token": "VALUE FOR ColVar",
"refresh_token": "xxx",
"expires_in": 3600000,
"token_type": "Bearer"
}
Collection 2 (CollRefTokenDev is not being updated)
let jsonResponse = pm.response.json();
console.log(jsonResponse);
pm.collectionVariables.set("CollRefTokenDev", jsonResponse.access_token);
RESPONSE
{
"access_token": "VALUE FOR ColVar",
"refresh_token": "xxx",
"expires_in": 3600000,
"token_type": "Bearer"
}
How I found the problem:
No error message when sending the request, new access token can be seen in the response, but collection variable is unchanged.
I’ve already tried:
renaming collection variable, deleting its initial value