cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to set JSON value in HTTP monitor | Postscript execution

I have below a sample response body, where I am able to set presignedURL but the orderId value is not working in the postscript.

{
"presignedUrl": "https://abcd.com",
"status": {
"orderid": "CCIR#6bad551aa2724d60b8bf249c5dab8a7f",
"error_code": "",
"message": "",
"status": "SUCCESS"
}
}

When I tried the below postscript, it was giving syntax error.
if (response.getStatusCode() != 200) {
api.fail("HTTP error: " + response.getStatusCode());
}
var responseBody = response.getResponseBody();
var jsonData = JSON.parse(responseBody);
api.info(jsonData.presignedUrl);
api.setValue("oderid-1", jsonData.status.orderid);
api.info(jsonData.status.orderid);
}
Another way also I tried but still same error 
if (response.getStatusCode() != 200) {
api.fail("HTTP error: " + response.getStatusCode());
}
var responseBody = response.getResponseBody();
var jsonData = JSON.parse(responseBody);
api.info(jsonData.presignedUrl);
api.setValue("oderid-1", jsonData.status["orderid"]);
api.info(jsonData.status.["orderid"]);
}

Did anyone know any suggestions?

Regards, Venkat

 

2 REPLIES 2

ChadTurner
DynaMight Legend
DynaMight Legend

@VenkataSainath were you able to get a work around or a solution to this issue? 

-Chad

 @ChadTurner , Yes, I can able monitor now,

 

I was doing mistake by using request.setBody("requestBody"), Instead that I have passed "OrdeID" in body of the monitoring by using {OrderID}

 

Regards,

Venkat

 

 

Featured Posts