- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2024 12:17 AM
Hello all,
I need a steps to do the below requirements.
1. Hit an API to get updates.
2. Script needs to get scheduled daily to call API
3. Parse response and create incident based on "Hitcount" value in response.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2024 01:07 AM
Hi @Divyabharathi C,
You can achieve your requirements by creating the below records.
1. Create a scheduled Job with occurrence as Daily at the non business hours, So it will handle huge load.
2. Create a rest message using the API and test.
3. Copy the script by clicking on "Preview Script Usage" related link.
4. Use the script in your scheduled job.
5. Parse the response that you receive from triggering API, In your case "Hitcount".
Sample parse script:
/*Response
{
"Name": "123",
"Hitcount": 10
}
*/
var responseBody = response.getBody();
var msg = JSON.parse(responseBody);
gs.info(msg.Hitcount);
while(var i < Hitcount)
{
//Script to create incident based on your reqirement.
i++
}
Use the sample script based on your requirement.
Kindly mark this as Helpful if it solves your query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2024 01:07 AM
Hi @Divyabharathi C,
You can achieve your requirements by creating the below records.
1. Create a scheduled Job with occurrence as Daily at the non business hours, So it will handle huge load.
2. Create a rest message using the API and test.
3. Copy the script by clicking on "Preview Script Usage" related link.
4. Use the script in your scheduled job.
5. Parse the response that you receive from triggering API, In your case "Hitcount".
Sample parse script:
/*Response
{
"Name": "123",
"Hitcount": 10
}
*/
var responseBody = response.getBody();
var msg = JSON.parse(responseBody);
gs.info(msg.Hitcount);
while(var i < Hitcount)
{
//Script to create incident based on your reqirement.
i++
}
Use the sample script based on your requirement.
Kindly mark this as Helpful if it solves your query.