How to use the API

Are you becoming confident in vScope and want to build something by yourself? This post will give you an introduction to the vScope’s REST API.

vScope takes care of all the data gathering in your datacenter and makes the information easily accessible for anyone on your team. While vScope provides an intuitive user interface which lets you browse your IT in a completely new way, there might be occasions when you need to extract the data from vScope to elsewhere. This can be done via vScope’s API and here is an example of how to do it!

Extract IP Addresses and other values from vScope

In this tutorial I will go through a basic use case making use of vScope’s REST API. vScope’s frontend is built in AngularJS and makes use of this API. The exact same API is open to use for anyone with a licensed vScope which enables you to build basically anything based on the vScope data.

Prerequisites

In order to access the API you will either need to have Guest access enabled in vScope or to be logged in to your vScope. You can do this either directly in vScope and then return to the documentation; Or you can authenticate yourself via /rest/usermanager/authenticate.

Accessing the API

You can access the vScope API and its documentation via your browser:

[server-name]/apidoc

Here you’ve got access to all GET, POST, PUT & DELETE requests that you can make use of in your project. The REST API is fully documented, generated on the fly with swagger. Swagger also allows you to do requests directly via the documentation.

Let’s get started!

My goal here is to create a basic, general IP-list based on the data from vScope. It might not sound like much to the world but the same workflow holds true for extracting almost any data. So let’s start by extracting a list of IP addresses from vScope.

First, a short story about tablePresets…

To tell vScope what we want to extract we either need to build a tablePreset (a “table”) in Table Explorer, or use any of the bundled tablePresets in vScope. The bundled tablePresets are basically tables with columns and filters (found under Tailored Recommendations), or a list of all elements of a specific resource (Servers, IP addresses, Printers etc.).

All tablePresets for resources can be found under the All Resources dropdown in Table Explorer:

vscope api

Basically, a tablePreset is just the structure of what a table should look like. For example:

  • the name of the table
  • which columns that should be shown
  • filters that should be applied (that are visualized in the filter panel)

tablePresets can utilized by the same API-endpoints as Table Explorer uses, i.e. the /tables endpoints.

…and something about tableTypeId

Each tablePreset is built upon a specific table type (tableTypeId). This id can be found directly under the tablePreset name in Table Explorer.  You can also see this as the name of the main resource in a Table.

The tableTypeId tells vScope what the main resource of a tablePreset is, and thus the tags (information) that should be included when loading the table. For example, accessing a tablePreset with tableTypeId=printers won’t, by default, include information tags about LUNs or Datastores

Leave a Reply