Learning about REST APIs > Start working with REST APIs |  | next

# Start working with REST APIs

Prerequisites

- To make individual REST calls to the HPE OneView API, you will need to install a REST-client extension (add-on or plug-in) into your web-browser.

  To install the client, visit your browser's Tools, Add-ons, or Extensions page to search for, download, and install the appropriate extension. For example, you could install REST Client for the Firefox browser, or Advanced REST Clientor Postman for the Chrome browser.

| NOTE: In the following example, it is assumed that HPE OneView has already been configured for initial use with Administrator access. If HPE OneView has not yet been configured, additional steps are required which are not included in this example. It is also assumed you already know how to use the REST client to construct API statements.

Starting to work with REST APIs

1. Once the extension is installed, re-start your browser and browse to the HPE OneView login-screen as you normally would.

   | IMPORTANT: Be sure to accept the security exception (certificate) or the browser will block further requests.

2. Open a new tab in the same browser, and start your REST-client extension.

3. Make your first REST-call a `GET` request. Enter the appliance URL and press SEND.

   For example:

       https://192.168.1.101/

   You should receive a `200(OK)` response and some text.

   If you receive a `0` status instead, check that you accepted the certificate as noted in step 1.

4. Make your second REST-call an operation to get your Session-ID for subsequent operations.

   1. Add the following two `http`-headers to your request:

          Content-type: application/json
          Accept: application/json

   2. Add the text-body (RAW-text) with a valid username and password.

      For example:

          {"userName":"administrator","password":"mypassword"}

   3. Set the request to be:

          https://192.168.1.101/rest/login-sessions

   4. Set the request-type to: `POST` and SEND your request.

   You should receive a `200 OK` status and a sessionID similar to the following:

       {
       "sessionID": "2zCmY9frjiYp1XIzsCiu2H1EjUgmcy08"
        }

   If you receive a `403 (Forbidden)` response, check that your credential is valid.

5. Add a third header with your new sessionID.

   1. Make your third request.

      For example:

          Auth: 2zCmY9frjiYp1XIzsCiu2H1EjUgmcy08

   2. Set the request to be:

          https://192.168.1.101/rest/version

   3. Set the request to `GET` and SEND your request.

   You should receive the appliance version.

       {
       "minimumVersion": 1,
       "currentVersion": 120
       }

   See the HPE OneView REST API Reference for additional requests and additional header requirements.

prev | up | next
Learning about REST APIs | home | Log in to the appliance using REST APIs

Copyright © 2013-2016 Hewlett Packard Enterprise Development LP