- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 11:18 PM
Hi All,
I would like to have an integration to pull the data from an external source and create records in a custom table. The daa will be pulled every sec and should create/update the corresponding records. Can someone help? The external API is created with a token for security purpose.
The API Information sample is below.
GET https://mydomain.net/api/vm/
Content-Type: application/json
Authorization: token <insert token here>
Also below is the JSON Sample.
[
{
"vm": "vm-123",
"name": "ABCSharePoint",
"power_state": "POWERED_ON",
"cpu_count": 4,
"memory_size_MiB": 24576,
"resource_pool": "resgroup-123",
"pool_name": "ABC-SQL",
"vsphere_instance": "ABC_INFRA",
"total_disk_MiB": 697796,
"timestamp": "2022-01-03T12:23:20.781822+04:00"
},
{
"vm": "vm-12345",
"name": "XYZ-ADC1",
"power_state": "POWERED_OFF",
"cpu_count": 4,
"memory_size_MiB": 16384,
"resource_pool": "resgroup-1234",
"pool_name": "XYZ-DC",
"vsphere_instance": "ABC_INFRA",
"total_disk_MiB": 42949,
"timestamp": "2022-01-03T12:23:20.981633+04:00"
}
]
Thanks,
Rijeesh Rathnakumar
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 09:38 AM
Hi,
Please find the steps below to achieve your requirement:
1) Create a Outbound Rest API by navigating to the module "Outbound Rest" as shown below:
2) Click on New button and give a valid Name as shown below:
3) Now click on New under HTTP Method as shown below and select method as "Get"
4) Define your HTTP header and then you can write a Async or After Insert and Update Business Rule on your table where you want and use the script below to fetch the response
Sample script shared below to be used in BR:
try {
var r = new sn_ws.RESTMessageV2('Get Records', 'Get Records');
//override authentication profile
//authentication type ='basic'/ 'oauth2'
//r.setAuthenticationProfile(authentication type, profile name);
//set a MID server name if one wants to run the message on MID
//r.setMIDServer('MY_MID_SERVER');
//if the message is configured to communicate through ECC queue, either
//by setting a MID server or calling executeAsync, one needs to set skip_sensor
//to true. Otherwise, one may get an intermittent error that the response body is null
//r.setEccParameter('skip_sensor', true);
var response = r.execute();
var responseBody = response.getBody();
for(var i=0;i<responseBody.length;i++){
createRecord(responseBody[i]);
}
var httpStatus = response.getStatusCode();
function createRecord(responseBody[i]){
var gr = new GlideRecord('Table Name');
gr.initialize();
gr.FIeldName = responseBody[i].vm;
gr.FIeldName = responseBody[i].name;
gr.FIeldName = responseBody[i].power_state;
gr.FIeldName = responseBody[i].cpu_count;
gr.insert();
}
}
catch(ex) {
var message = ex.message;
}
This way you can fetch the response and then parse it and insert record.. Let me know if you are facing an issue.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2022 02:10 AM
Hi,
Go through this series on how to setup REST Message.
https://www.youtube.com/watch?v=PC-h8U3Wuso&list=PLzTvAeLiW8Ae4-8eJWNhzFyTqovD9LaaR
Mark it as Helpful if it helps you in any case.
Regards,
Sourabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2022 05:10 AM
Hi Sourabh,
Thank you for your response. Let me see the videos and will comment.
Thanks,
Rijeesh Rathnakumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2022 04:26 AM
Hi,
Please Mark the above answer as Helpful/Correct, In Applicable. Thanks.
Regards,
Sourabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2022 11:19 AM
Hi Sourabh,
Thanks, I am able to configure the REST Message. Can you please guide me on how to create a business rule to fetch the data from third part API? I am getting the reponse in json format. I would like to create multiple records using the payload information.
Can you please help me here?
Thanks,
Rijeesh Rathnakumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 09:46 PM
Hello Sourabh,
Can you please help me to configure the BR to create/update the records using the payload information?
Thanks,
Rijeesh Rathnakumar