Hi Community!
I am struggling to set a variable from a POST result.
In POST request #1, I create a user group called “Groupe 2”. I would like to store the record Id in a variable (“Groupe2Id”). In POST request #2, I create new users and would like to assign to them the default_group_id = {{Groupe2Id}}.
POST #1 result:
{
“group”: {
“url”: “https://z3ntest2delphine.zendesk.com/api/v2/groups/360007949978.json”,
“id”: 360007949978,
“name”: “Groupe 2”,
“description”: “”,
“default”: false,
“deleted”: false,
“created_at”: “2021-06-17T16:23:57Z”,
“updated_at”: “2021-06-17T16:23:57Z”
}
}
To store my variable, I have in the Test script of POST #1 :
var response = pm.response.json();
pm.environment.set(“Groupe2Id”, response.id);
--------> The variable is well created, but the value is null
I precise that :
- I have created an environment and my requests are in a collection.
- I have searched during many hours in documentation + this forum (I precise that I am a new / not a coder).
Can you please help me? Where am I wrong?
Thanks a lot