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
06-16-2014 11:05 AM
Model_IDs?
In regards to the MAC address, I am not sure why it would do that since the parser should be taking it from between the quotes, even with the ":" in the string. Without testing, not sure whats going on there.
If you can't amend it at the source, you might want to look at a string replace before you parse the result. Loop through and look for the "mac_address" and then do a string replace between the quotes for the ":" and replace with a "." or something else.
Once parsed, do another sting replace.
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2014 12:01 PM
I got the MAC addresses working by changing the field type in the import set to string instead of integer.
Model ID was also set to integer, but changing that to a string did not help bring that in on import. The model ID on a CI is just a reference to another table. I've already created all the model IDs associated with this specific import so it should just reference the correct one on transform.
It does not appear to be doing this correctly. Do I need to change the field type on the import set to reference and point it to the hardware model table for this to work properly? (that's what I will be trying next)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2014 12:13 PM
I assume the value being imported into the import table is the sysID or the display value.
I would convert the modelID field it to a string, if not done so already on the transform table.
When the data has been load to transform, if you copy the ModelID and do a lookup on the referencing table sys_id, does it match? Just a confirmation that it's referencing correctly.
Pete