I am trying to pass the task-id response value from a verify-policy request in Postman as an environment variable. However, it appears that the output of "task-id" is not a valid json reference? Based on my testing it appears to be because of the dash "-" in the name "task-id". Does anyone know of another why to retrieve this value?
Here is my request:
I perform a verify-policy POST and get the following response:
{
"task-id" : "01234567-89ab-cdef-9966-b355dd0c80f1"
}
That request also has a test script to take the value of "task-id" and put it in my environment as variable "tk".
var jsonData = JSON.parse(responseBody);
//use task as variable
postman.setEnvironmentVariable("tk", jsonData.task-id);
But executing this results in error, and the output from the Postman console indicates it is not defined, despite it shown in the response body.
ReferenceError | id is not defined
Also i think the API reference documentation is incorrect as the only response i get from a web-session API call is the task-id, i do not receive the failure messages. The only output I receive from my verify-policy POST is a task-id (contrary to the API reference with results for failure), whether the verification is good or has errors. Therefore I am trying to also view the results of the verification task when it completes. I am using the task-id in a following request to view the output of the verification (i.e. show-task API request).