03-15-2017 08:09 AM
Might be the wrong place to post, but I thought I would ask.
I am trying to use the REST API 3.1 guide on Cisco DevNet for the Get Configuration Diff and it doesn't pull up any details on how to use it. Is there another place that I can find the documentation on how to use this?
Here is the link to the API guide, Cisco DevNet: prime-infrastructure - REST API - v3.1 API Reference
Thanks
Dave
Solved! Go to Solution.
03-15-2017 02:00 PM
Ooh, looks like there's a problem with this and some of the other pages in our scrape of the API docs. Thanks for raising this issue. I'll have to look into this.
In the meanwhile, to address your immediate need, you can download this PDF of the doc page: config_diff.pdf - Box
03-15-2017 02:00 PM
Ooh, looks like there's a problem with this and some of the other pages in our scrape of the API docs. Thanks for raising this issue. I'll have to look into this.
In the meanwhile, to address your immediate need, you can download this PDF of the doc page: config_diff.pdf - Box
03-16-2017 05:20 AM
So am I using this correct? (I assume not because I am getting an error ) Because I get:
[dsampson@mnet-ws-dave ~]$ curl -k "https://user:pass@cpi/webacs/api/v1/op/configArchiveService/configDiff/172.25.232.1"
<?xml version="1.0" ?>
<errorDocument>
<httpResponseCode>500</httpResponseCode>
<httpMethod>GET</httpMethod>
<message>Device not found in system: 172.25.232.1</message>
<exception>com.cisco.ncs.nbi.ops.configArchive.ConfigArchiveException: Device not found in system: 172.25.232.1</exception>
<uriPath>op/configArchiveService/configDiff/172.25.232.1</uriPath>
<queryParams>{}</queryParams>
</errorDocument>[dsampson@mnet-ws-dave ~]$
[dsampson@mnet-ws-dave ~]$
03-16-2017 10:35 AM
Hmm, ensure that the IP that you passed in is the management IP of the device that's known to Prime. Also, if you're using virtual domains, ensure that the device is in the same virtual domain as the API user (querying /webacs/api/v2/data/Devices?.full=true&ipAddress=172.25.232.1 as the same user should verify that).
03-16-2017 11:04 AM
/webacs/api/v2/data/Devices?.full=true&ipAddress=172.25.232.1 works fine and returns data for the device. I can retrieve multiple configs using the webacs/api/v1/data/ConfigVersions?.full=true&deviceName=startsWith("cob1-oet")';
03-16-2017 11:14 AM
Odd, what version of PI are you using? Have you installed any patches/updates?
03-16-2017 11:19 AM
CPI version 3.1 will all the updates with the exception of the latest device pack 9.
03-16-2017 11:36 AM
Dave, could please you pull logs from the server (in the UI, Administration > Settings > Logging) shortly after running the configDiff query? Please reach out to me via email (my address is on my communities.cisco.com profile for logged in users).
03-17-2017 01:32 PM
Thank you for sending the logs.
From what I can see in them, it confirms what I was able to find locally: if the device was added to PI's inventory by hostname instead of by IP, then the hostname needs to be specified as the device request parameter for the configDiff request. The deviceName response parameter of the Devices resource is what you're looking for. (So in your case, /op/configArchiveService/configDiff/cob1-oet...)
The documentation for this resource is incorrect and misleading, so we'll address that. The description for the device request parameter should read: The device name or the management address of the device. The management address is the address used to add the device to the managed inventory, either an IP address or hostname.
Furthermore, the deviceIp response parameter is a bit of a misnomer, and it's description should read: The management address of the device. The management address is the address used to add the device to the managed inventory, either an IP address or hostname.
So in sum, you can specify either the device name or the management address of the device to configDiff. If the device was added by name, device name and management address are often the same (device.example.com) but may be different (device name is self-reported and configurable, but the management address must resolve and be reachable from PI). In the case of discovery, where you don't know what type of management address was used to add the device to inventory, I'd recommend using device name instead.
Lastly, I just want to make sure that you're aware that the documentation available on developer.cisco.com is also available on your Prime Infrastructure server (visit https://your_server/webacs/api/v1). A couple of the advantages of viewing the docs from your server is that they'll most closely match your server (and include any changes we made in maintenance releases, which we generally don't post to DevNet) and they offer a search bar.
I hope this resolves your issue! If not, please do reach out to me, and please do reach out with any other issues you come across.
03-20-2017 06:52 AM
Thanks for the location information on the API for Prime, it is similar to ISE with the API information located on the server. I wasn’t aware of that.
I did try the cURL statement with the device name and then the management IP but with no luck. Should I delete and add the device to see it is works once I know how it was added via the name or IP address? Also, if I need to submit a TAC case on this, just let me know. I don’t want to waste your time.
Here are the results from the cURL commands and a screen shot from our Prime.
$ curl -k "https://xxxxxx:xxxxxxx@somcpi.mnet.state.mn.us/webacs/api/v1/op/configArchiveService/configDiff/cob1-oet.r.state.mn.usxxxxxxx@somcpi.mnet.state.mn.us/webacs/api/v1/op/configArchiveService/configDiff/cob1-oet.r.state.mn.us"
$ curl -k "https://xxxxxx:xxxxxxx@somcpi.mnet.state.mn.us/webacs/api/v1/op/configArchiveService/configDiff/172.25.232.1xxxxxxx@somcpi.mnet.state.mn.us/webacs/api/v1/op/configArchiveService/configDiff/172.25.232.1"
[dsampson@mnet-ws-dave prime]$
03-20-2017 08:00 AM
You can create a TAC case if you like, we can continue to try to solve the issue here, or both.
If it's an option, yeah, try to delete the device and it back.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide