16 Mar 2023
11:28 PM
- last edited on
17 May 2023
04:57 AM
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