cud

Turbonomic REST API Series Part 2: First Things First

Blog Post created by cud Expert on Nov 26, 2014

Like many service applications today, Turbonomic exposes its data and processing through a REST API. This means you can use HTTP methods to get information from Operations Manager, execute actions in your environment, or integrate Operations Manager with other work flows. This post is a continuation of the API Series that started with this post Turbonomic REST API Series Part 1: Introduction to Use Cases

 

This series will get you started implementing API solutions tailor-made for your situation. But for you to use the API effectively, we should first cover a few basics.

 

Data Model

Your ability to use any API is only as good as your understanding of the product and its data model.  In Operations Manager the fundamental data model is the Market. This is where analysis takes place, and what Operations Manager uses to decide on the actions to execute or recommend. Outside of the Market, Operations Manager includes services and utilities to take care of things like:

  • User accounts
  • Groups
  • Reservations and deployment
  • Templates
  • To Do lists
  • Logging
  • Target management

 

As an Operations Manager user or administrator, you should be familiar with all of these, but the API will give you a deeper understanding.  We’ll cover how the API maps to Operations Manager data in much more detail as this series progresses.

 

 

HTTP Methods

To use a REST API, you pass URLs to the server -- the URLs execute specific HTTP methods. The Operations Manager REST API supports the following methods:

  • GET to retrieve information about entities or other objects in the market or services
  • POST to create objects or change states of things
  • DELETE to, well, delete things

 

 

Returned Data

When you execute a REST method, the server returns with data.  The data it returns depends on the method you execute, as follows:

  • GET returns XML data, for example:
    <TopologyElements>
    <TopologyElement creationClassName="User" displayName="Root User" name="root" uuid="_4T_7kQY-Ed-WUKbEYSVIDw"/>
    <TopologyElement creationClassName="User" displayName="Guest User" name="guest" uuid="_4T_UggY-Ed-WUKbEYSVIDw"/>
    ...
    </TopologyElements>
  • POST and DELETE usually return HTTP error status, but sometimes return XML data

 

 

URL Setup

The following is a typical URL to execute a GET method. This example will get a list of all the user accounts on the Operations Manager server:

http://RESTuser:RESTuserPwd@YOURVMTIPAddress/vmturbo/api/users

 

Every URL you execute will include:

  • User credentials
    In the example above, RESTuser:RESTuserPwd
  • The Operations Manager server address
    In the example above, YOURVMTIPAddress
  • A common API base
    In the example above, /vmturbo/api

 

 

Try It Out

If you have Operations Manager version 5.0, you can try out GET methods risk-free directly from the online version of the API Guide. We encourage you to open up the guide and navigate to any of the Resources sections. From there, expand a GET method and try it out to see what the data looks like on your installation.

 

 

 

 

The API Guide is a good tool to help you explore the API and see what sort of data is available. Give it a whirl and get yourself used to the way our API works.  If you want the PDF go here Turbonomic REST API GUIDE 5.1 pdf format

 

In later posts we’ll look at specific resources you can access, paying attention to the data they return, and any special techniques you can use to develop associated solutions.  As you explore with the API Guide, let us know if you see any specific areas you’d like us to cover.

 

Have fun browsing around the market!

Eva and Chris

Outcomes