vendredi 31 mars 2017

can not extract response body to set environment variable

I have response body from POST method like below

{
    "status": {
        "error": false,
        "code": 200,
        "message": "Login success"
    },
    "result": {
        "data": {
            "name": "vv",
            "email": "gg@gmail.com",
            "session_key": "xxx"
        }
    }
}

Then I want to extract that session key to add in the environment variable I used this code

var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("session", jsonData.sesssion_key);

But on the environment variable still return with "undefined" value Please help, Thanks

Aucun commentaire:

Enregistrer un commentaire