Wait for REST API Response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 06:51 AM
We have a scenario where we have to call a REST API to create new Standard Change (only way create std change). But when creating standard change though API it takes long time and Ideally response body has new change number but sometimes response is undefined though in change_request table a change is created. We need response as it contains change number and change number is important for rest of the functions/script to run.
Thank You.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 07:41 AM
Hello @kunjangondalia ,
You can make use of waitForResponse(seconds) function as below -
var response = r.executeAsync();
response.waitForResponse(60); //pass the seconds to wait
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
you can also refer below link for more details -
If my answer solves your issue, please mark it as Accepted and Helpful based on the impact.