Back to our IP plan
Now, if I just want to get the values from a specific tag for a specific resource (ie. IP of the resource IP address) we can use the following end-point:
tableId is a reference to a bundled Table preset and is in almost all cases the same as the resource name for the presets under All Resources. The
tagName is the same as in the Column picker or Filter panel:
So in this case when we want to get all IP addresses we simply call:
%20, this is URI-equivalent of space)
or by using Swagger:
This will return a string array of all known IP addresses from vScope, both IPv4 and IPv6. So click Try it Out and see for yourself!
Congratulations, you have succeeded in your first API extraction!
Interested in any other information?
Likewise, if we only want the Type of the IP addresses listed we simply replace
Type in the request, like this:
This endpoint is very versatile since it can get a list of almost every value in vScope. Just note that the requested
tagName must be a tag that can be found in the Column picker in Table Explorer for that
An easy way to get available tags for a specific
tablePreset from the API is to call:
Extending our IP plan
So now you have a list of IPs. Nice! But to turn this extraction into a more useful IP-plan, I will also include the Attached Names property of the
IP Addresses. Now, this will require the use of a different endpoint:
Or in Swagger:
In the example earlier we referenced an existing
tablePreset using an ID, but in this case we will create our own. The
tablePreset‘s structure can be quite complicated, but for our purposes we only need a simple one.
tablePreset we will use has the following structure (in JSON):
"tableTypeId": "IP Addresses",
Note that there are a lot of fields not included in this example. Consult the API-documentation if you want a full description of a
tablePreset (above) needs to be URI-Encoded before it can be used in the api request. There is a multitude of online tools that can do this for you This one for example (Meyerweb). After it has been encoded it will look like this:
tablePreset will then be passed to the api as a header parameter, with the field name ‘Table-Preset’. Using curl it looks like this:
curl -X GET --header 'Accept: application/json'
--header 'Table-Preset: %7B%0A%09%22%40c%22%3A%20%22.TablePresetAPI%22%2C%0A%09%22tableTypeId%22%3A%20%22IP%20Addresses%22%2C%0A%09%22columns%22%3A%20%5B%0A%09%09%22IP%22%2C%0A%09%09%22Attached%20Names%22%0A%09%5D%0A%7D'
Via swagger it will look like this:
Hit Try it Out and your result should look something like this:
/rest/tables/custom/rows also accepts
take as query parameters. This will allow you to load the data in a lazy manner. This is done by adding the following to the request url:
?skip=0&take=20. By default it will return all rows.
This tutorial was just a short introduction on extracting a basic IP-list from vScope. It might be relevant for some, but it should really only be seen as the starting point to create amazing stuff from the vScope data. Let vScope become your Discovery Engine gathering and structuring data from all over the datacenter and use it as your main data source for your IT!