17 Mar 2023 06:28 AM - last edited on 17 May 2023 12:57 PM by AgataWlodarczyk
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
Solved! Go to Solution.
08 Jun 2023 03:09 PM
@VenkataSainath were you able to get a work around or a solution to this issue?
09 Jun 2023 03:11 PM
@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