- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 02:23 AM
Hi Team ,
How do I check if the API call from a 3rd party is successful or failed ?
How should I update the worknote only once? The next call should not update the worknote in inc ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 02:31 AM
you can use below code to check API call fail/pass
// Make API call to third-party system
var response = thirdPartyApiCall();
// Check if the API call was successful
if (response && response.getStatusCode() === 200) {
// API call was successful
var responseBody = response.getBody(); // You can inspect the response body for further details
gs.info("API call successful. Response: " + responseBody);
// Update incident or take further actions based on the response
} else {
// API call failed
gs.error("API call failed. Status code: " + response.getStatusCode());
// Handle error scenario or log error details
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 02:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 02:45 AM
yes , but thing need to achieve , but some them configured via import set as well.
Whenever it call for the first time only that time will it will update the work note in the incident or if it failed,
after that need to send notification(email ) to concern team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 02:28 AM
Hi @jaiho_rai
How do I check if the API call from a 3rd party is successful or failed ?
Atul: Its code, like 200 is considered as success code.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 02:49 AM
That I understood but specifically it should work only for the first-time call, they have multiple things scripted apis and import set.