Skip to main content

Quick Start

This example will walk you through three different https rest calls that can be made to the API. They are:

  1. Fetch the schema

    Perform a GET to:

     

    https://IPADDRESS/api/sdk/p/2/schema?withMatchingDisplayLabel=ESX%20VM&returnNameOnly=true&returnProperties=NONE&returnMetricsWithMatchingDisplayLabel=VM.*CPU.*

     

    The response will contain schema information about entity types that match the ESX VM entity name, and will provide the results for all metrics matching the patten VM.*CPU.*.

    For our scenario we note that the entity type ID is Virtual Machine and the metric ID is VM_cpu_used

  2. Find the entity identifiers

    Perform a GET to:

    https://IPADDRESS/api/sdk/p/2/inventory/type/VirtualMachine?filterProperty=DisplayLabel&filterValue=<partial_vm_name>&filterOperator=iContains&prop=EntityType&prop=uid&prop=DisplayLabel

    Notice

    Replace the <partial_vm_name> place holder with a name of one of your ESX VMs

    The response will contain the first 10 ESX VMs, whose display label (i.e. name) matches the <partial_vm_name> value provided. For each VM the entity type, uid, and display label will be returned.

    For our scenario we note the uid for the desired ESX VM.

  3. Query trend data - last 24 hours

    Perform a GET to:

    https://IPADDRESS/api/sdk/p/2/metrics/trend?metric=VM_cpu_used&entityId=<entity_uid>&startTime=-86400&granularity=AUTO&groupBy=ENTITY_TIMESTAMP_VERBOSE

    Notice

    Replace the <entity_uid> place holder with the UID of the ESX VM identified in step 2

    The response will contain VM CPU Utilization trend data for the given entity, over the 24 hours (starting from the current time). The response will come back in a verbose form (where metric ids area repeat with every value)

     

The remainder of this example will provide some more details on each of the three calls made, including some expanded options for optimization and bulk fetching. Refer to the swagger documentation for more detailed breakdown (and optimization recommendations) for each rest call.