Running a REST query to populate a table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2014 12:39 PM
In the process of setting up an integration between a 3rd party CMDB and ServiceNow. They have provided a REST API to query their database.
I have used both SOAP and REST queries in the past to pull specific data on demand and use it, but in this case, I'm looking to take the response and put it into a data source so that I can transform it into the CMDB.
Does anyone have any suggestions for the following:
1. Where should the REST messages be called from? I was thinking a scheduled job since it does not need to be on demand.
2. What method should I use to take the response and write that to a table?
3. Where should I store the response form the REST message so that I can run a transform against it and populate various cmdb tables? I was thinking for servers and computers, I could use the imp_computer table and utilize the transform script (with some adjustments) that already exists.
Thanks for your input.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2014 01:47 PM
My suggestion would be:
1. As you say, scheduled job
2. You can script REST API calls so on the schedule job, call the query from there. Details are on the wiki on how to script but when you set one up, there is a link that gives you demo code.
3. Either create a custom table to put the data in then transform against it or on the the scheduled job, just create the script to update the CMDB directly though that will depend on your policies and processes
Pete.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2014 02:06 PM
What method would you use to write the REST message response to a table. It comes back in CSV or JSON format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2014 02:12 PM
The REST response will be in JSON format. ServiceNow has a JSON parser which can parse the response and then run the script against it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2014 07:02 AM
The part I'm struggling with is how do I write a script to put the REST response into a table.
I'd like to to drop the records into a table and then run a transform on it as you suggested above.
Been looking for examples of something similar, but unable to locate anything.
Thanks