Outbound REST API GET from XML Response to Table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2018 10:14 AM
So I have an Outbound REST API GET setup correctly and the test is pulling the data back correctly. I am trying to pull (using a GET) CIs from a third party tool into my cmdb (Access Points to a new Access Point table that extends from the Network Gear table)
It is pulling all the devices with the information needed, but I need help getting those devices into the new table. How should I go about doing this? This needs to happen on a reoccurring basis, so something scheduled would be preferred. I want to split out each entity to be its own record, making one of the fields the unique field.
Here is an example of the xml response:
<?xml version="1.0" ?>
<queryResponse last="99" first="0" count="455" type="AccessPoints" responseType="listEntityInstances" requestUrl="" rootUrl="">
<entity dtoType="accessPointsDTO" type="AccessPoints" url="">
<accessPointsDTO displayName="693695" id="693695">
<adminStatus>ENABLE</adminStatus>
<bootVersion>1.1.2.4</bootVersion>
<clientCount>0</clientCount>
<clientCount_2_4GHz>0</clientCount_2_4GHz>
<clientCount_5GHz>0</clientCount_5GHz>
<controllerIpAddress>10.1.5.130</controllerIpAddress>
<controllerName></controllerName>
<countryCode></countryCode>
<ethernetMac></ethernetMac>
<hreapEnabled>false</hreapEnabled>
<ipAddress></ipAddress>
<location>default location</location>
<lwappUpTime>170020453</lwappUpTime>
<macAddress>/macAddress>
<model></model>
<name></name>
<serialNumber></serialNumber>
<softwareVersion></softwareVersion>
<status></status>
<type></type>
<upTime></upTime>
</accessPointsDTO>
</entity>
<entity dtoType="accessPointsDTO" type="AccessPoints" url="">
<accessPointsDTO displayName="693700" id="693700">
<adminStatus>ENABLE</adminStatus>
<bootVersion>15.2.4.5</bootVersion>
<clientCount>0</clientCount>
<clientCount_2_4GHz>0</clientCount_2_4GHz>
<clientCount_5GHz>0</clientCount_5GHz>
<controllerIpAddress></controllerIpAddress>
<controllerName></controllerName>
<countryCode>US</countryCode>
<ethernetMac></ethernetMac>
<hreapEnabled>false</hreapEnabled>
<ipAddress></ipAddress>
<location>Store</location>
<lwappUpTime>1538746054</lwappUpTime>
<macAddress></macAddress>
<model></model>
<name></name>
<serialNumber></serialNumber>
<softwareVersion></softwareVersion>
<status></status>
<type></type>
<upTime></upTime>
</accessPointsDTO>
</entity>
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 08:40 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 08:43 PM
Running the script just as you have it worked perfect. It seems to break once I parse the outbound api get response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 08:46 PM
One other thing I noticed is your '/macAdress>' tag is missing an opening angle bracket. I corrected that when I ran the script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 08:49 PM
Yeah that was just me cleaning up the data on the xml. see the xml attached for the full xml response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 08:54 PM
Could you show me your code to retrieve the payload? You're using RestMessageV2.execute() and RestResponseV2.getBody()?