NAM REST API

REST (Representational State Transfer) offers the developer a relatively uncomplicated way to use web services. The REST API provided for DMI enables you to write RESTful applications that read a report server database (or the cache) and returns the results in JSON format.

Note

User group permission to query a REST service is controlled per REST service. This is not user-customizable.

The dmiquery service is allowed for users who have the following roles: Administrator, Reporting Admin, and Reporting Power User.

REST methods

This small set of methods is sufficient to write a RESTful DMI application:

  • getApplications
    Use getApplications to list all applications available on the device you are addressing.
  • getDataViews
    Use getDataViews to list all data views for one of the applications available on the device you are addressing.
  • getResolutions
    Use getResolutions to list the resolutions for one data view and one application on the device you are addressing.
  • getDimensions
    Use getDimensions to list the dimensions for one resolution, one data view, and one application on the device you are addressing.
  • getMetrics
    Use getMetrics to list the metrics for one resolution, one data view, and one application on the device you are addressing.
  • getDMIData, getDMIData2, getDMIData3
    These are three successive versions of essentially the same method. If you have already developed applications that use calls to getDMIData or getDMIData2, you can continue to depend on support for them. If you are developing a new application, use getDMIData3.

Each DMI REST request includes the server address, the name of the service (“dmiquery”), and specification of the method, such as:

http://ipaddress/rest/dmiquery/getApplications

which sends a getApplications request to the “dmiquery” service running on ipaddress.

Parameters are case-sensitive.

See DMI service method reference for details on these methods, and see REST examples for example requests.

REST developer tools and tips

During development, the best tool is a good REST browser plug-in.

RESTClient (http://restclient.net/) is just one example of various browser plug-ins available for developing REST applications for DMI. You may find others equally useful.

Information about RESTClient included here was true at the time of writing, but you should refer to the website for more recent information.

RESTClient gives you a single window through which you can define and send REST commands to a device and view the response sent by the device. You use it to develop and test the commands you will add to your app.

It includes the following:

Method

The HTTP method (GET or POST) with which to pass the request to the device.

URL

The URL, including the device address and port number and the DMI resource specification (such as /rest/dmiquery/getDMIData3).

Headers

You need to specify an Authorization header and a Content-Type header for a DMI application.

  1. Select Headers ► Custom Header.
  2. Set Name to Content-Type.
  3. Set Value to application/json.
  4. Click Okay.
  5. Select Headers ► Custom Header.
  6. Set Name to Authorization.
  7. Set Value to Bearer {token}.
    where {token} is a public API token value copied from the NAM Console System Users ► API tokens screen.
  8. Click Okay.

Body

For getDMIData, getDMIData2, and getDMIData3, you need to use this field (with a POST call) to specify request details that cannot be included in the URL.

Response

These tabs display the response header (including status code) and three views of the response body.