Can any one let me know why i am getting the below error as undefined

Request body:

let response = pm.response.json();


pm.environment.set("token", response.createdAt)

pm.test('Verifying the ID Value', function(){






Request in Post:

Respose body:


    "name": "morpheus",
    "job": "leader",
    "id": "808",
    "createdAt": "2020-09-08T11:54:02.679Z"

I have created 2 environment variable ID and token for ID and Createdat response. Please help me out on this

Hello @shota331 you are still having this issue? Usually undefined is displayed when you add the parameters and there is no values defined it under any level (Global, environment etc…)

May be the below blog will be useful:

I ran the request with the test script you provided. I’m going to guess that you’re just talking about the console log saying undefined.

The blog post that @bpricilla provided will probably help on understanding what variables are. I can’t quite follow what you’re trying to do.

Problems that I see:

  • You are trying to grab values that don’t exist
  • You are testing that a variable is equal to itself
  • You are trying to console log variables that don’t exist.
  • There is no createdAt property in the response

Here is what I think you’re trying to do:

const response = pm.response.json();

const ids =, 'id');
pm.test('Values are returned with Ids', function(){

  pm.environment.set('ids', JSON.stringify(ids));