+ All Categories
Home > Documents > Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History...

Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History...

Date post: 21-Mar-2018
Category:
Upload: ngoxuyen
View: 318 times
Download: 4 times
Share this document with a friend
34
Oracle ® ILOM Web Service Rest API User Guide and Security Reference for Firmware Release 4.0.x Part No: E87200-02 December 2017
Transcript
Page 1: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Oracle® ILOM Web Service Rest APIUser Guide and Security Reference for Firmware Release 4.0.x

Part No: E87200-02December 2017

Page 2: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle
Page 3: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Oracle ILOM Web Service Rest API

Part No: E87200-02

Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Exceptas expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform,publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, isprohibited.

The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.

If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable:

U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation,delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplementalregulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on thehardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government.

This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerousapplications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take allappropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of thissoftware or hardware in dangerous applications.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks ofSPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registeredtrademark of The Open Group.

This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates arenot responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreementbetween you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content,products, or services, except as set forth in an applicable agreement between you and Oracle.

Access to Oracle Support

Oracle customers that have purchased support have access to electronic support through My Oracle Support. For information, visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info or visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are hearing impaired.

Page 4: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Référence: E87200-02

Copyright © 2017, Oracle et/ou ses affiliés. Tous droits réservés.

Ce logiciel et la documentation qui l'accompagne sont protégés par les lois sur la propriété intellectuelle. Ils sont concédés sous licence et soumis à des restrictions d'utilisation etde divulgation. Sauf stipulation expresse de votre contrat de licence ou de la loi, vous ne pouvez pas copier, reproduire, traduire, diffuser, modifier, accorder de licence, transmettre,distribuer, exposer, exécuter, publier ou afficher le logiciel, même partiellement, sous quelque forme et par quelque procédé que ce soit. Par ailleurs, il est interdit de procéder à touteingénierie inverse du logiciel, de le désassembler ou de le décompiler, excepté à des fins d'interopérabilité avec des logiciels tiers ou tel que prescrit par la loi.

Les informations fournies dans ce document sont susceptibles de modification sans préavis. Par ailleurs, Oracle Corporation ne garantit pas qu'elles soient exemptes d'erreurs et vousinvite, le cas échéant, à lui en faire part par écrit.

Si ce logiciel, ou la documentation qui l'accompagne, est livré sous licence au Gouvernement des Etats-Unis, ou à quiconque qui aurait souscrit la licence de ce logiciel pour lecompte du Gouvernement des Etats-Unis, la notice suivante s'applique :

U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation,delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplementalregulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on thehardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government.

Ce logiciel ou matériel a été développé pour un usage général dans le cadre d'applications de gestion des informations. Ce logiciel ou matériel n'est pas conçu ni n'est destiné à êtreutilisé dans des applications à risque, notamment dans des applications pouvant causer un risque de dommages corporels. Si vous utilisez ce logiciel ou ce matériel dans le cadred'applications dangereuses, il est de votre responsabilité de prendre toutes les mesures de secours, de sauvegarde, de redondance et autres mesures nécessaires à son utilisation dansdes conditions optimales de sécurité. Oracle Corporation et ses affiliés déclinent toute responsabilité quant aux dommages causés par l'utilisation de ce logiciel ou matériel pour desapplications dangereuses.

Oracle et Java sont des marques déposées d'Oracle Corporation et/ou de ses affiliés. Tout autre nom mentionné peut correspondre à des marques appartenant à d'autres propriétairesqu'Oracle.

Intel et Intel Xeon sont des marques ou des marques déposées d'Intel Corporation. Toutes les marques SPARC sont utilisées sous licence et sont des marques ou des marquesdéposées de SPARC International, Inc. AMD, Opteron, le logo AMD et le logo AMD Opteron sont des marques ou des marques déposées d'Advanced Micro Devices. UNIX est unemarque déposée de The Open Group.

Ce logiciel ou matériel et la documentation qui l'accompagne peuvent fournir des informations ou des liens donnant accès à des contenus, des produits et des services émanant detiers. Oracle Corporation et ses affiliés déclinent toute responsabilité ou garantie expresse quant aux contenus, produits ou services émanant de tiers, sauf mention contraire stipuléedans un contrat entre vous et Oracle. En aucun cas, Oracle Corporation et ses affiliés ne sauraient être tenus pour responsables des pertes subies, des coûts occasionnés ou desdommages causés par l'accès à des contenus, produits ou services tiers, ou à leur utilisation, sauf mention contraire stipulée dans un contrat entre vous et Oracle.

Accès aux services de support Oracle

Les clients Oracle qui ont souscrit un contrat de support ont accès au support électronique via My Oracle Support. Pour plus d'informations, visitez le site http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info ou le site http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs si vous êtes malentendant.

Page 5: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Contents

Using This Documentation .................................................................................  7

Using the Oracle ILOM Web Service REST API ..................................................  9Introduction and Prerequisites ...........................................................................  9

Secure Access to Oracle ILOM Web Service REST Application ......................  9Prerequisites for Using the Oracle ILOM Web Service REST Application ........  11

Access and Authentication ..............................................................................  12▼ Accessing the JSON File on the SP Using Swagger ................................  12Web Service Authentication Using Authorization Header ..............................  14Authentication Token Expiration and Logout ..............................................  15

Retrieval and Modification of Oracle ILOM Data ................................................ 16Supported HTTP Operations for Retrieving and Modifying Oracle ILOMData ....................................................................................................  16JSON Formatted GET Response Examples ................................................  20Instances Where a GET Response Is Not Returned For a Target Resource .........  26PATCH Request With JSON Input Data Examples ....................................... 26POST Request With JSON Input Data Example ..........................................  27

Perform Firmware Updates Using the Oracle ILOM Web Service API .....................  28▼ Upload the Local Firmware Package File .............................................. 29▼ View and Configure the Firmware Update Properties ..............................  30▼ Initiate the Firmware Update Installation and Poll the Status .....................  31

▼ Dump Full Console History Using the Oracle ILOM Web Service API ...............  31

Security Considerations for Web Service REST API .........................................  33Supported REST API Client Authentication Methods ...........................................  33

5

Page 6: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

6 Oracle ILOM Web Service Rest API • December 2017

Page 7: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Using This Documentation

■ Overview – Provides getting started information for accessing and using the OracleIntegrated Lights Out Manager (ILOM) Web Service Representational State Transfer(REST) application programming interface (API).

■ Audience – Web application architects, developers, or administrators who need to performthe tasks or learn about the concepts in this guide.

■ Required knowledge – Experience with web development, specifically HTTP and JSON,and REST API programming skills.

Product Documentation Library

Documentation and resources for this product and related products are available at http://docs.oracle.com/cd/E81115_01/index.html.

Feedback

Provide feedback about this documentation at http://www.oracle.com/goto/docfeedback.

Using This Documentation 7

Page 8: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

8 Oracle ILOM Web Service Rest API • December 2017

Page 9: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Using the Oracle ILOM Web Service REST API

Use the following information in this chapter to help you get started with using the OracleILOM Web Service REST API to access and modify Oracle ILOM resources.

■ “Introduction and Prerequisites” on page 9■ “Access and Authentication” on page 12■ “Retrieval and Modification of Oracle ILOM Data” on page 16■ “Perform Firmware Updates Using the Oracle ILOM Web Service API” on page 28■ “Dump Full Console History Using the Oracle ILOM Web Service API” on page 31

Introduction and Prerequisites

The Web Service REST API for Oracle ILOM is a secure programming interface that enablesrequesting HTTP clients to access and manipulate server management resources. For furtherinformation about accessing the REST API or prerequisites for using the REST API, see thefollowing topics:

■ “Secure Access to Oracle ILOM Web Service REST Application” on page 9■ “Prerequisites for Using the Oracle ILOM Web Service REST Application” on page 11■ “Related Security Information” on page 12

Secure Access to Oracle ILOM Web Service RESTApplication

The Oracle ILOM Web Service REST API is supported across many Oracle server modelsrunning Oracle ILOM firmware version 4.0 or later. Secure access to the Web Service RESTapplication is obtained by specifying the REST endpoint URL of the management device. Forinstance:

https://device_IP address:443/rest/v1

Using the Oracle ILOM Web Service REST API 9

Page 10: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Introduction and Prerequisites

Where:

■ device _IP_address:443 represents the REST API endpoint URL of the device in which youwant to manage.

Note - 443 is the default network port used by Oracle ILOM for web configuration (HTTPSover TCP). If a network port is not specified, the Oracle ILOM Web Service REST API willautomatically use the default port (443) to gain access.

■ rest/v1 represents the major version of the REST API. By specifying a version in a RESTrequest, you can get expected responses regardless of future changes to the API.

URIs (Unified Resource Identifiers) define the name or location of resources in the OracleILOM Web Service REST API data model. The top-level URIs in the Web Service REST APIdata model are as follows:

■ /rest/v1/About

■ /rest/v1/System

■ /rest/v1/SP

■ /rest/v1/HOST

Target resources under the top-level URIs can iterate a collection of any of the followingentities:

■ Name and value pair properties within single target resource■ Additional target resources within a single target resource■ A single name/value pair property within a target resource■ Actions to invoke on a target resource

The top-level REST-only target /About provides information identical to the About buttonin the Oracle ILOM web interface. Using a GET operation on this target identifies the OracleILOM firmware version, copyright notice, and legal notice.

The top-level REST-only targets for /System, /SP and /Host contain similar information to theOracle ILOM CLI targets for /System, /SP, and /HOST. It is possible that Oracle ILOM userswill know in advance the URIs to target based on their familiarity with the Oracle ILOM CLItree.

IMPORTANT: Any URI with a trailing "/" is not a valid Oracle ILOM REST URI. Forexample, these URIs are not valid: /rest/v1/ or /rest/v1/SP/ . Any attempt to use aninvalid URI will result in a failure of the request.

10 Oracle ILOM Web Service Rest API • December 2017

Page 11: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Introduction and Prerequisites

Descriptions of the REST top-level targets, HTTP verbs, resources, and properties are viewablethrough the Swagger UI tool.

Prerequisites for Using the Oracle ILOM WebService REST Application

Before performing actions described in this chapter, note the following prerequisites andrecommendations:

■ Oracle ILOM Web Service REST API users should have experience with web development,specifically HTTP and JSON, as well as REST API programming skills.

■ The Oracle ILOM Web Service REST API is available on servers running Oracle ILOMfirmware version 4.0 or later.

■ To access the Oracle ILOM Web Service REST application, you can use any tool orprogramming library that can generate HTTP requests. For instance, the following tools canaccess the REST application in various capacities:■ Swagger UI tool – Swagger is a user interface (UI) tool that enables you to view the

Web Service REST application descriptions, as well as to modify the Web ServiceREST application data. You can download the Swagger UI tool (zip file) from Swaggersoftware.

Note - This chapter includes instructions for using Swagger to open a JSON file on aservice processor (SP) and accessing the Web Service REST API descriptions.

■ cURL – cURL is a command-line tool for getting or sending files using URL syntax, aswell as modifying REST API data. cURL is available for download from http://curl.haxx.se/

Note - This guide uses cURL to express examples for constructing URIs.

■ Web Browser with the Postman REST Client Plug-in Extension – A web browserwith REST client plug-in extension enables you to retrieve the Web Service REST APIdata. However, it does not support modifying the Web Service REST API data.

■ Java and Python HTTP Libraries – Languages such as Java and Python includeHTTP libraries that you can use to interact with the REST application.

■ Oracle ILOM should be properly configured with a Web Server SSL Certificate (defaultprovided self-signed or user installed CA signed).

Using the Oracle ILOM Web Service REST API 11

Page 12: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Access and Authentication

For server certificate configuration information, see “Improve Security by Using a TrustedSSL Certificate and Private Key” in Oracle ILOM Security Guide For Firmware Releases3.x and 4.x

Related Security Information

■ “Security Considerations for Web Service REST API ” on page 33■ Oracle ILOM Security Guide For Firmware Releases 3.x and 4.x

Access and Authentication

For supported authentication methods, as well as instructions for using Swagger to extract theJSON file on the SP, see the following topics:

■ “Accessing the JSON File on the SP Using Swagger” on page 12■ “Web Service Authentication Using Authorization Header” on page 14■ “Authentication Token Expiration and Logout” on page 15

Accessing the JSON File on the SP UsingSwagger

A machine readable description of the Oracle ILOM REST API is available in Swaggerformat. This description of the Web Service REST API includes information on every resourceavailable under the four top-level resources: /About, /System, /SP, and /Host. The applicableHTTP verbs, resource property types, configurable properties, and a description string for eachavailable property are available in the Swagger description

You can obtain a Swagger description of the Oracle ILOM Web Service REST API by issuing aURL to the Swagger JSON file on the managed SP device, for instance:

https://<target_SP_IP_address>/swagger.json.

The following instructions explain how to extract the Swagger UI tool and use it to access theJSON file on the SP:

1. Extract the Swagger UI zip file to a directory on the Oracle ILOM SP device. Forexample:

12 Oracle ILOM Web Service Rest API • December 2017

Page 13: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Accessing the JSON File on the SP Using Swagger

/C:/Users/your_username/Downloads/

2. Open a web browser and enter the file path to the Swagger UI tool. For example:file:///C:/Users/your_username/Downloads/swagger-ui-master/dist/index.html

The Swagger UI appears in the web browser.

3. In the Swagger UI search box, enter the URI to the swagger.json file. Forexample:https://SP _IP_address:443/swagger.json

Where: SP_IP_address represents the IP address of the target SP device.

If the swagger.json appears in the web browser, proceed to Step 5. Otherwise, if the swagger.json file fails to load and the following message appears, proceed to Step 4 for troubleshootinginstructions.

Can't read from Service. It may not have the appropriate access-control-origin

settings.

4. (Optional Troubleshooting Step) If the swagger.json file failed to display in Step3, follow these steps:

Note - The web browser might have not accepted the web server certificate on the SP.

a. Open another web browser window and enter the following URL:https://SP_IP_address/swagger.json

b. Follow the instruction on the browser dialogs to add an exception for the SP.The swagger.json file appears in the browser window.

c. Return to Swagger UI browser window (described in Step 3) and click theExplore button.The swagger.json file appears.

5. To view the full swagger description of the Oracle ILOM Web Service REST API,click the Expand Operations link.

6. To use the Swagger UI tool to access and modify Oracle ILOM resources, clickthe Authorize button, and then when prompted, enter your Oracle ILOM username and password.

Using the Oracle ILOM Web Service REST API 13

Page 14: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Accessing the JSON File on the SP Using Swagger

At the time of login, your user credentials on the target SP device are authenticated by theOracle ILOM Web Service REST API. For further authentication details, see the followingtwo topics : “Web Service Authentication Using Authorization Header” on page 14 and“Authentication Token Expiration and Logout” on page 15.

Web Service Authentication Using AuthorizationHeaderThe first step in accessing the Oracle ILOM Web Service is an authentication step that identifiesthe client Oracle ILOM user credentials (user name and password) on the target SP device.This step initiates authentication with the Web Service by submitting an HTTP POST requestfrom the client to the server that includes an HTTP "Authorization" header. For example, theauthorization header might look something like this:

-H "Authorization:BASIC cm9vdDpjaGFuZ2VtZQ=="

Where:

■ The characters after BASIC are an encoded string of Base64 characters that represent theOracle ILOM user credentials. In this example, cm9vdDpjaGFuZ2VtZQ represents theencoded string for root:changeme.

The POST authentication login request sent from the client to the server needs to include the SPdevice target URI (https://device_IP address:443/rest/v1/login). A cURL generated example ofan authentication login request to a SP target URI would look something like this:

curl --request POST -H "Authorization:BASIC cm9vdDpjaGFuZ2VtZQ==" -k -v

https://SP_device_IP_address:443/rest/v1/login

Where:

■ cm9vdDpjaGFuZ2VtZQ== in this example represents the encoded user credentials for the rootOracle ILOM user account (root:changeme).

■ -k and -v options are cURL command-line options. The -k option instructs cURL tobypass HTTPS certificate verification. The -v option is used to instruct cURL to turn onverbose mode.

Note - In the real use of the Web Service REST API, Oracle ILOM should be configuredto use either the default self-sign web server SSL certificate or a user installed certificateauthority signed SSL certificate.

■ SP_device_IP_address represents the IP address of the target SP device.

14 Oracle ILOM Web Service Rest API • December 2017

Page 15: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Accessing the JSON File on the SP Using Swagger

■ The POST request must include the HTTP header Content-Type: application/json for allHTTP operations that return a response body in JSON format. For an example of POSTrequest showing an HTTP header ContentContent-Type: application/json, see Table 1,“HTTP Commands to Read or Modify Data,” on page 17.

If the authentication login step is successful, an HTTP response body is returned by the SPserver containing a JSON object. The JSON object includes a single name-value pair where:(1) the name is the X-Rest-Token string, and (2) the value is a unique string representingthe current client login session on the target SP device. For example, the body of the HTTPresponse, in JSON format, would look something like this:

{"X-Rest-Token": "GVOgNuNPOFBJmGMbiaLxuujZfDGTPX"}

Where:

■ "GVOgNuNPOFBJmGMbiaLxuujZfDGTPX" represents the unique encoded value stringfor the current client login session. This unique string must be included as a header in allsubsequent HTTP requests associated with this session.

Note - The SP returns a different X-token value for each HTTP command request.

Non-Token Request Mode – HTTP Authorization Header

As a convenience option, a non-token request mode is also available where the authenticationand resource request steps are combined. For a non-token request mode, the user credentials areincluded with every request in the HTTP Authorization header. The usual authentication step toobtain the REST token is not needed.

A cURL generated example of a non-token request is as follows:

curl --tlsv1.2 --request GET -H "Accept:application/json" -H "Authorization:BASIC

cm9vdDpjaGFuZ2VtZQ==" -k -v https://<IP addr>:443/rest/v1/System/locator_indicator

The "curl" utility allows specification of the user credentials instead of the "Authorization"header itself.

curl --tlsv1.2 --request GET -H "Accept:application/json" --user root:changeme -k -v

https://<IP addr>:443/rest/v1/System/locator_indicator

Authentication Token Expiration and LogoutThe authentication token returned by the server SP will automatically expire in approximately15 minutes of not receiving an incoming client request. REST API clients can intentionally

Using the Oracle ILOM Web Service REST API 15

Page 16: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

expire the authentication token by issuing a POST logout request to the SP target URI (https://device_IP_address:443/rest/v1/logout).

For example, a generated logout request using cURL would look something like this:

curl --request POST -H "X-Rest-Token:"GVOgNuNPOFBJmGMbiaLxuujZfDGTPX" -k -v https://SP_device_IP_address:443/rest/v1/logout

Where:

■ GVOgNuNPOFBJmGMbiaLxuujZfDGTPX represents the unique encoded value string foran HTTP command request .

■ SP_device_IP_address represents the IP address of the target SP device.

Because access to the Oracle ILOM Web Service REST API is expected to be in bursts withrelatively long intervals between bursts, it is good practice to use the logout request to free upresources for use by other clients.

Retrieval and Modification of Oracle ILOM Data

Refer to the following topics for resource supported HTTP operations and examples of JSONdata formatted responses and requests.

■ “Supported HTTP Operations for Retrieving and Modifying Oracle ILOMData” on page 16

■ “JSON Formatted GET Response Examples” on page 20■ “Instances Where a GET Response Is Not Returned For a Target Resource” on page 26■ “PATCH Request With JSON Input Data Examples” on page 26■ “POST Request With JSON Input Data Example” on page 27

Supported HTTP Operations for Retrieving andModifying Oracle ILOM Data

The following tables describe the supported HTTP operations:

■ Table 1, “HTTP Commands to Read or Modify Data,” on page 17■ Table 2, “HTTP Commands to Retrieve, Create, Delete, or Invoke Action ,” on page 18

16 Oracle ILOM Web Service Rest API • December 2017

Page 17: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

Note - For all cURL examples shown in this guide, the -k option is used to instruct cURL tobypass HTTPS certificate verification. In the real use of the REST API, Oracle ILOM should beconfigured to use the default HTTPS certificate or install a certificate authority signed HTTPScertificate. The -v option is used to instruct cURL to turn on verbose mode.

TABLE 1 HTTP Commands to Read or Modify Data

Operation HTTP Command HTTP CommandDescription

Command Example Using cURL HTTP Command Header Fields

Read GET resource URI A GET requestreturns the stateof the requestedOracle ILOMresource.

An example of a cURL GET URIrequest referencing the /System targetnode is as follows:

curl --request GET -

H "Accept:application/

json" -H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo"

-k -v https://IP_address:443/rest/v1/System

The response for this GET example willreturn the JSON representation of alltargets, actions, and properties underthe /System target node,

To access a specific property under atarget node such as /System, you wouldconstruct the GET URI with a forwardslash (/) between the target node andthe property name, for example:

curl --request GET -

H "Accept:application/

json" -H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo"

-k -v https://IP_address:443/rest/v1/System/property_name

Use of header fields for a GET requestinclude:

■ (Mandatory) X-Rest-Token (-H"X-Rest-Token:value")

A GET request must contain the "X-Rest-Token" header containing theOracle ILOM REST token value.

■ (Optional) Accept (-H "Accept:application/json"):

A GET request can contain theAccept header to specify thecontent type of the application/json file or any superset of theapplication/json file.

PartialModification

PATCH resourceURI

{payload=input}

A PATCH requestmodifies aproperty setting ofan existing OracleILOM resource.

An example of a cURL PATCH URIrequest referencing the /System targetresource is as follows:

curl --request PATCH -H

"Content-Type:application/

json" -H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo"

-k -v --data

'{"locator_indicator":

"On" }' https:

Use of header fields for a PATCH requestinclude:

■ (Mandatory) Content Type (-H"Content-Type:application/

json")

A PATCH request must specify acontent type header to indicate theMIME type of the PATCH request.

Using the Oracle ILOM Web Service REST API 17

Page 18: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

Operation HTTP Command HTTP CommandDescription

Command Example Using cURL HTTP Command Header Fields

//IP_address:443/rest/v1/System

In this PATCH commandexample, the payload input data({"locator_indicator":"On" }) identifies the applicableproperty and value to modify underthe target /System URI (https://IP_address:443/rest/v1/System).

■ (Mandatory) X-Rest-Token (-H"X-Rest-Token:value")

A PATCH request must contain an X-REST token header containing theOracle ILOM REST token value.

■ (Mandatory) Payload Input Data

A PATCH request must contain theJSON formatted payload inputdata to indicate which property andvalue needs to be modified underthe target resource.

TABLE 2 HTTP Commands to Retrieve, Create, Delete, or Invoke Action

Operation HTTP Command HTTP CommandDescription

Command Example Using cURL HTTP Command Header Fields

Create aresource

POST resource URI{payload=resource

input data}

A POST requestcreates a newtarget resource.

A cURL example of using a POST URIrequest to create an Oracle ILOM user isas follows:

curl --request POST -H

"Content-Type:application/

json" -H "X-Rest-Token:

VkAHTjpOxBPRPGzIWqpkZjQRXeifdE"

-k -v --data '{"user_name":

"jane", "password":

"changeme" }' https:

//IP_address:443/rest/v1/SP/users

In this POST URI example, the payloadinput data ({"user_name": "jane","password": "changeme"})identifies the applicable object nameand password string to create underthe URI target resource (https://IP_address:443/rest/v1/SP/users).

Use of header fields to create a targetresource using a POST request URIinclude:

■ (Mandatory) X-Rest-Token (-H"X-Rest-Token:value")

A POST request to create a resourcemust contain an X-REST tokenheader containing the Oracle ILOMREST token value.

■ (Mandatory) Payload Input Data

A POST request must contain theJSON formatted payload input datato indicate which property and valuepairs need to be created under thetarget URI resource.

Delete aresource

DELETE resourceURI

A DELETE URIrequest deletesa target resourcenode.

A cURL example of a DELETE URIrequest to remove the propertiesassociated with an Oracle ILOM user isas follows:

curl --request DELETE

-H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo"

Use of header field for Delete requests:

■ (Mandatory) X-Rest-Token header(-H "X-Rest-Token:value")

18 Oracle ILOM Web Service Rest API • December 2017

Page 19: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

Operation HTTP Command HTTP CommandDescription

Command Example Using cURL HTTP Command Header Fields

-k -v https://IP_address:443/rest/v1/SP/users/jane

In this DELETE URI request example, theproperties associated with user namejane are removed from the resourcetarget /SP/users .

Invoke anaction

POST resource URI{payload=specifiedaction}

A POST URIrequest invokesa custom OracleILOM REST APIaction.

Custom OracleILOM REST APIactions include:

■ "reset":reboots theOracle ILOMSP or host.

■ "soft-reset":gracefullyresets theOracle ILOMhost.

■ "power-on":powers on theOracle ILOMhost.

■ "power-off":powers off theOracle ILOMhost.

■ "soft-power-

off": softpowers off theOracle ILOMhost

■ "version":displays theOracle ILOMfirmwareversion

A cURL example of a POST URI requestinvoking a custom Oracle ILOM RESTAPI action is as follows:

curl --request POST -H

"Content-Type:application/

json" -H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo"

-k -v --data '{"op":

"version"}' https:

//IP_address:443/rest/v1/SP

In this POST URI example, the payloadinput data ({"version"}) defines thecustom action to invoke on target URIresource (https://IP_address:443/rest/v1/SP).

Use of header fields to invoke a customOracle ILOM REST API action using aPOST request URI include:

■ (Mandatory) Content Type (-H"Content-Type:application/

json")

A POST request invoking a customaction must specify a content typeheader to indicate the MIME type ofthe request body.

■ (Mandatory) X-Rest-Token (-H"X-Rest-Token:value")

A POST request invoking a customaction must include a X-REST tokenheader containing the Oracle ILOMREST API token value.

■ (Mandatory) Payload Input Data

A POST request invoking a customaction must contain the JSONformatted payload input data toindicate which custom action toinvoke on the target URI node.

Using the Oracle ILOM Web Service REST API 19

Page 20: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

JSON Formatted GET Response ExamplesA GET request retrieves information from the Oracle ILOM Web Service REST API datamodel. The response data from a GET request is returned from the server in JSON format. Ifthe URI references a target Oracle ILOM resource, the JSON object returned could contain thefollowing:

■ The top-level resource name/value pairs■ Unlimited number of optional top-level name value pairs representing the properties under

the target resource■ Top-level name/value pairs representing the actions applicable to the target resource

For additional information about the JSON data output returned for a GET request, see theseexamples:

■ “Example: General JSON-Schema GET Response for Resource Targets” on page 20■ “Example: JSON Object GET Response for Multiple Properties Under a Top-Level

Resource ” on page 21■ “Example: JSON Object GET Response for Single Property Under a Top-Level Resource

” on page 22■ “Example: General JSON-Schema GET Response for Audit or Event Log

URIs” on page 23■ “Example: JSON Object GET Response for Event Log” on page 23■ “Example: JSON Object GET Response for Specific Log Count and Start

IDs” on page 24■ “Example: General JSON-Schema Formatted GET Response for System Log

URIs” on page 25■ “Example: General JSON-Schema GET Response for Open Problems URI” on page 25

Note - Some of the examples in this section use cURL to generate the GET requests.

Example: General JSON-Schema GET Response for ResourceTargets

The following example represents a sample layout of JSON-Schema objects returned in a GETresponse body for a generated GET request.

{"Target":"target path" "<property1 name>":"<property1 value>" "<property2 name>":"<property2 value>" "<property3 name>":"<property3 value>"

20 Oracle ILOM Web Service Rest API • December 2017

Page 21: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

"Targets":

{"name":"<target1 name>","uri":"<target1 uri>","path":"target1 path>"} {"name":"<target2 name>","uri":"<target1 uri>","path":"target2 path>"}

"Actions":{"name":"action1 name"},{"name":"action2 name"}}

Where:

■ If the URI references a target resource, the JSON object returned contains three well-knowntop-level name/value pairs and an unlimited number of optional top-level name/value pairsrepresenting properties under the target resource.

■ The first well-known top-level name/value pair represents the URI of the target ILOMresource. This well-known top-level name/value pair is always present. The name is thestring "Target." The value is the URI of the target Oracle ILOM node.

■ The second well-known top-level name/value pair represents the next-level targets availablein the Oracle ILOM resource that the URI represents. This well-known top-level name/value pair is only present if any such next-level targets exist. The name is the string"Targets." The value is a JSON array where each element represents an Oracle ILOM target.Each element is represented by a JSON object containing two name/value pairs. The firstname/value pair represents the name of the target where the name is the string "name" andthe value is the name of the target. The second name/value pair represents the URI of thetarget where the name is the string "uri" and the value is the URI string.

■ The third well-known top-level name/value pair represents the actions that are applicableto the target. This well-known top-level name/value pair is only present if any such actionsexist. The name is the string "Actions." The value is a JSON array where each elementrepresents an action. Each element is represented by a JSON object containing one name/value pair which represents an action. The name is the string "name" and the value is thename of the action.

■ The optional top-level name/value pairs represent the properties available under the OracleILOM resource node. Each name/value pair has the name part set to the name of theproperty and the value part set to the value of the property.

Example: JSON Object GET Response for Multiple PropertiesUnder a Top-Level Resource

In the following cURL generated example, a client GET request is submitted to the server for theOracle ILOM /System resource:

curl --request GET -H "X-Rest-Token:xlJVfsCdTkrPdAPQFxkhmLUsKBfZKs" -H "Accept:

application/json" -k -v https://<IP addr>:443/rest/v1/System

If the GET request is successful, JSON output for the /System resource target, similar to thefollowing, is returned by the server:

{"Target":"/rest/v1/System",

Using the Oracle ILOM Web Service REST API 21

Page 22: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

"health":"OK",

"health_details":"-",

"open_problems_count":"0",

"type":"Rack Mount",

"model":"ORACLE SERVER X7-2L",

"qpart_id":"Q10543",

"part_number":"X7-2EF-P1.0A-01",

"serial_number":"12345678",

"system_identifier":"",

"system_fw_version":"4.0.0.0",

"primary_operating_system":"Not Available",

"primary_operating_system_detail":"Comprehensive System monitoring is not available.

Ensure the host is running with the Hardware Management

Pack. For details go to http://www.oracle.com/goto/ilom-redirect/hmp-osa",

"host_primary_mac_address":"00:10:e0:57:79:74",

"ilom_address":"10.153.57.91",

"ilom_mac_address":"00:10:E0:57:79:78",

"locator_indicator":"Off",

"power_state":"Off",

"actual_power_consumption":"34 watts",

"Targets":

[{"name":"Open_Problems", "uri":"/rest/v1/System/Open_Problems"},

{"name":"Processors", "uri":"/rest/v1/System/Processors"},

{"name":"Memory", "uri":"/rest/v1/System/Memory"},

{"name":"Power", "uri":"/rest/v1/System/Power"},

{"name":"Cooling", "uri":"/rest/v1/System/Cooling"},

{"name":"Storage", "uri":"/rest/v1/System/Storage"},

{"name":"Networking", "uri":"/rest/v1/System/Networking"},

{"name":"PCI_Devices", "uri":"/rest/v1/System/PCI_Devices"},

{"name":"Firmware", "uri":"/rest/v1/System/Firmware"},

{"name":"BIOS", "uri":"/rest/v1/System/BIOS"},

{"name":"Log", "uri":"/rest/v1/System/Log"}],

"Actions":

[{"name":"power-on"},

{"name":"power-off"},

{"name":"soft-power-off"},

{"name":"reset"}]}

Example: JSON Object GET Response for Single PropertyUnder a Top-Level Resource

In the following example, a client GET request referencing the "locator_indicator" propertyunder the /System resource target is generated using cURL :

curl --request GET -H "X-Rest-Token:xlJVfsCdTkrPdAPQFxkhmLUsKBfZKs" -H "Accept:

application/json" -k -v https://<IP addr>:443/rest/v1/System/locator_indicator

22 Oracle ILOM Web Service Rest API • December 2017

Page 23: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

If the GET request is successful, a JSON object, similar to the following, is returned by theserver:

{"locator_indicator":"Off"}

Example: General JSON-Schema GET Response for Audit orEvent Log URIs

The following example represents a sample layout of JSON-schema objects returned in a GETresponse body for Event Log or Audit Log URIs:

{"Log":{"id":"<log entry 1 id>","datetime":"<log entry 1 datetime>","class":" <log entry

1 class>""type":"<log entry 1 type>",

"severity":"<log entry 1 severity>","description":"<log entry 1 description>"}, {"id":"

<log entry 2 id>","datetime":"

<log entry 2 datetime>","class":"<log entry 2 class>", "type":"<log entry 2 type>","

severity":"<log entry 2 severity>","description":"

<log entry 2 description>"}]}

Where:

■ The top-level name/value pair will either have the name of "EventLog" or "Audit Log"depending on the whether the URIs represent the Event Log or the Audit Log.

■ The top-level name/value pair is a JSON array where each element represents a single entryin the Event Log or Audit Log.

■ Each element of the array is a JSON object containing six name/value pairs, one each torepresent the log entry "id," "date and time," "class," "type," "severity," and "description."

Example: JSON Object GET Response for Event Log

In the following example, a client GET request to the Oracle ILOM Event Log resource isgenerated using cURL :

curl --request GET -H "Accept:application/json" -H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo" -k -v https://<IP addr>:443/rest/v1/SP/logs/event/list

If the GET request is successful, JSON output for the Event Log resource, similar to thefollowing, is returned by the server:

{"Log":[{"id":"257","datetime":"Tue Mar 22 15:16:25 2017","class":"BIOS","type":"

Update","severity":"major","description":"BIOS update successful"},

{"id":"256","datetime":"Tue Mar 22 15:12:22 2017","class":"System","type":"Log","

severity":"critical","description":"SP is about to reboot"},

{"id":"255","datetime":"Tue Mar 22 15:12:22 2017","class":"System","type":"Log","

severity":"critical","description":"upgrade to version 4.0.0.0 succeeded"}]}

Using the Oracle ILOM Web Service REST API 23

Page 24: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

Example: JSON Object GET Response for Audit Log

In the following example, a client GET request to the Oracle ILOM Audit Log resource isgenerated using cURL :

curl --request GET -H "Accept:application/json" -H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo" -k -v https://<IP addr>:443/rest/v1/SP/logs/audit/list

If the GET request is successful, JSON output for the Audit Log resource, similar to thefollowing, is returned by the server:

{"Log":[{"id":"214","datetime":"Tue Mar 22 15:21:03 2017","class":"Audit","type":"UI","

severity":"minor","description":"root : Open Session :

object = \"/SP/sessions/1/type\" : value = \"www\" : success"},{"id":"213","datetime":"

Tue Mar 22 14:35:56 2017","class":"Audit","type":"UI",

"severity":"minor","description":"root : Close Session : object = \"/SP/sessions/2/type

\" : value = \"shell\" : success"}]}

Example: JSON Object GET Response for Specific Log Countand Start IDs

In the following example, a client GET request referencing a count and start variable for theAudit Log resource is generated using cURL :

curl -H "Accept:application/json" -H "X-Set-Rest-Token: vpBKacuZoIBarFnUtxTfFWxWehXeNZ"

-k -v "https://<IP addr>:443/rest/v1/SP/logs/audit/list?count=5&start=2324"

Note - Double quotes ("") are required around the URL ("https:…) and the query string(=2324").

If the GET request is successful, JSON output for the Audit Log resource, similar to thefollowing, is returned by the server:

{"Log":[{"id":"2323", "datetime":"Fri Aug 26 17:38:39 2017", "class":"Audit", "type":"

UI", "severity":"minor", "description":"root : Set :

object = \"/System/locator_indicator\" : value = \"off\" : success"},{"id":"2322",

"datetime":"Fri Aug 26 17:38:38 2017", "class":"Audit",

"type":"UI", "severity":"minor", "description":"root : Set : object = \"/System/

locator_indicator\" : value = \"off\" : success"},

{"id":"2321", "datetime":"Fri Aug 26 17:38:22 2016", "class":"Audit", "type":"UI",

"severity":"minor", "description":"root : Open Session :

object = \"/SP/sessions/14/type\" : value = \"rest\" : success"}, {"id":"2320",

"datetime":"Fri Aug 26 17:34:15 2017", "class":"Audit",

"type":"UI", "severity":"minor", "description":"root : Close Session : object = \"/SP/

sessions/13/type\" : value = \"rest\" : success"},

24 Oracle ILOM Web Service Rest API • December 2017

Page 25: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

{"id":"2319", "datetime":"Fri Aug 26 17:33:11 2017", "class":"Audit", "type":"UI",

"severity":"minor", "description":"root : Open Session :

object = \"/SP/sessions/13/type\" : value = \"rest\" : success"}]}

Example: General JSON-Schema Formatted GET Responsefor System Log URIs

The following example represents a sample layout of JSON-schema objects returned in a GETresponse body for System Log URIs:

{"SystemLog":[ {"id":"<log entry 1 id>","datetime":"<log entry 1 datetime>","type":"

<log entry 1 type>",

"subsystem":"<log entry 1 subsystem>","component":"<log entry 1 component>","

description":"<log entry 1 description>"},

{"id":"<log entry 2 id>","datetime":"<log entry 2 datetime>","type":"<log entry 2

type>",

"subsystem":"<log entry 2 subsystem>","component":"<log entry 2 component>","

description":"<log entry 2 description>"}]}

Where:

■ The top-level name/value pair has the name of "SystemLog."■ The top-level name/value pair value is a JSON array where each element represents a single

entry in the System Log.■ Each element of the array is a JSON object containing six name/value pairs. One each

to represent the log entry: "id," "datetime," "type," "subsystem," "component," and"description."

An example JSON object output GET response for the System Log is as follows:

{"SystemLog":[{"id":"16474","datetime":"Fri Feb 26 15:48:44 2017","eventtype":"System

OK","subsystem":"System","component":"MB (Motherboard)",

"description":"(UUID:6cc8706c-0f9c-47bd-9b4b-aa458c10fdf0, Resource:/SYS/MB, Part

Number:7066886, Serial Number:489089M+13494B004E,

Reference Document:http://support.oracle.com/msg/SPX86A-8005-KT)"}]}

Example: General JSON-Schema GET Response for OpenProblems URI

In the following example, a client GET request to the Oracle ILOM Open Problems resource isgenerated using cURL :

curl --request GET -H "Accept:application/json" -H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo" -k -v https://<IP addr>:443/rest/v1/System/Open_Problems

Using the Oracle ILOM Web Service REST API 25

Page 26: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

If the GET request is successful, JSON output for the Open Problems resource, similar to thefollowing, is returned by the server:

{"OpenProblems":[

{"id":"<log entry 1 id>","datetime":"<log entry 1 datetime>","component":"<log entry

1 component>",

"subsystem":"<log entry 1 subsystem>","description":"<log entry 1 description>"},

{"id":"<log entry 1 id>","datetime":"<log entry 2 datetime>","component":"<log entry

2 component>",

"subsystem":"<log entry 2 subsystem>","description":"<log entry 2 description>"}]}

Where:

■ The top-level name/value pair will have a name of "OpenProblems"■ The top-level name/value pair value is a JSON array where each element represents a single

entry in the Open Problems list. Each element of the array is a JSON object containingfive name/value pairs. One each to represent the log entry: "ids," "datetime," "component,""subsystem," and "description."

Instances Where a GET Response Is Not ReturnedFor a Target Resource

In some instances, the Oracle ILOM REST API will not return a GET response for a targetresource. For example, a GET response is not provided:

■ For a hidden property under a parent resource. However, a value is returned if the hiddenproperty is the target resource.

■ When a LUAPI backend call for a property fails. Note that the Oracle ILOM CLI will return"(none)" for LUAPI backend property call failures.

■ When a property value is "Not Available" or "Not Supported".■ When the property value is a write-only property. Note that the Oracle ILOM CLI returns

"(Cannot show property)") for properties that are write-only properties.■ When a property is not writable or does not have a default value. Note that the Oracle

ILOM CLI will return "(none)") for properties that do not contain a default value or is notwriteable.

PATCH Request With JSON Input Data ExamplesA PATCH request partially modifies information in the Oracle ILOM Web Service REST APIdata model. It instructs the server to modify a set of changes described in the request payloadand apply the change to the resource identified by in the PATCH request URI. The PATCH

26 Oracle ILOM Web Service Rest API • December 2017

Page 27: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Retrieval and Modification of Oracle ILOM Data

request is issued from the client along with the JSON formatted input payload data. The payloadcan contain multiple name/value pairs where each name/value pair represents a property underthe target that needs to be updated with the provided value. The general schema for the body ofa PATCH request is as follows:

{"<Property1 name>":"<Property1 value>", "<Property2 name>":"<Property2 value>",...}

A cURL example of a generated PATCH request with its accompany input data is as follows:

curl --request PATCH -H "Content-Type:application/json" -H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo" -k -v --data

'{"locator_indicator": "Off" }' https://<IP addr>:443/rest/v1/System

Where:

■ If the PATCH request is successful, the locator_indicator property under the /Systemresource target is set to Off.

POST Request With JSON Input Data ExampleA POST request can either add a new Oracle ILOM resource or it can invoke an action onan Oracle ILOM resource. When the POST verb is used to request the creation of a newOracle ILOM resource, the input data, at creation time, must specify the required and optionalproperties. The format of the payload to create an object is as follows:

{"user_name/community_name": "<value of object name>", "property1 name": "<property1

value>", "property2 name": "<property2 value>", ...}

When a POST request is used to invoke an action on an Oracle ILOM resource, the inputpayload data must identify, at a minimum, the name of the action to invoke. Additional datato invoke the action can also be included if appropriate. For instance, the actions for "reset","power-on", "power-off", "soft-power-off", "soft-reset" and "version" only need to be specifiedin the target object, which is derived from the URI.

For single JSON objects, the JSON array includes a single name/value pair where the name isthe string "op" and the name of action is the value. The general JSON schema for actions is asfollows:

{"op":"<command name>"}

A cURL example of a generated POST request with its accompany input data is as follows:

curl --request POST -H "Content-Type:application/json" -H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo" -k -v --data '{"op":"reset"}' https://<IP addr>:443/

rest/v1/System

Where:

Using the Oracle ILOM Web Service REST API 27

Page 28: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Perform Firmware Updates Using the Oracle ILOM Web Service API

■ The payload input data {"op":"reset"}, in this example, instructs the server to reset the hostat the designated /System URI.

When requesting actions such as "load" and "dump", the payload must identify the name of theaction and the URL to the target object where the action applies. For instance, the general JSONschema of the payload input data for "load" and "dump" actions is as follows:

{"op":"load", "method":"url", "url":"<url value>"}

Where:

■ The first name/value pair name is the string "op" and the value is a string representing theaction name, either "load" or "dump".

■ The second name/value pair name is the string "method" and value is the string "url".■ The third name/value pair name is the string "url" and the value is a string representing the

URL.

An cURL example of a generated POST request containing an action and accompany URL datais as follows:

curl --request POST -H "Content-Type:application/json" -H "X-Rest-Token:

LBiDHbTnrGeDJrLSDGaisLXIQMfVjo" -k -v --data '

{"op": "dump", method:"url", "url": "http://www.example.com/rom.pkg}' https://<IP addr>:

443/rest/v1/SP/config

Where:

■ {"op": "dump", method:"url", "url": "http://www.example.com/rom.pkg} representsthe action name "dump", the method type "url", and the target URL path "http://www.example.com/rom.pkg" where the action is applied at the specified URI https://<IPaddr>:443/rest/v1/SP/config

Perform Firmware Updates Using the Oracle ILOM WebService API

To ensure that users have access to the latest Oracle ILOM features and product enhancements,all upgradable system devices should be updated with the latest Oracle ILOM firmware release.

Note - In addition to using the Oracle ILOM Web Service API to update firmware onsystem devices, you can use the Oracle ILOM web interface or CLI. For further details, see“Performing Oracle ILOM Maintenance and Configuration Management Tasks” in OracleILOM Administrator’s Guide for Configuration and Maintenance Firmware Release 4.0.x

28 Oracle ILOM Web Service Rest API • December 2017

Page 29: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Upload the Local Firmware Package File

Using the Oracle ILOM Web Service API, the process for updating the Oracle ILOM firmwareimage on system devices involves these three tasks:

1. “Upload the Local Firmware Package File” on page 29

Note - For firmware download instructions, refer to "Oracle ILOM Firmware Versions andDownloads" in the Oracle ILOM Feature Updates and Release Notes Firmware Release4.0.x.

2. “View and Configure the Firmware Update Properties” on page 30.3. “Initiate the Firmware Update Installation and Poll the Status” on page 31

Upload the Local Firmware Package File

To upload the firmware package file and create the required firmware context onthe managed device, use the POST command. For example:Command:

curl -v --request POST -F "firmwarefile=local_directory_location -k -v -u "root:changeme" -H "Accept:application/json" https://IP addr:443/rest/v1/SP/firmware/update

Response:

{"Target":"/rest/v1/SP/firmware/update/1","Targets":[{"name":"questions","uri":"

/rest/v1/SP/firmware/update/1/questions"},{"name":"status","uri":"/rest/v1/

SP/firmware/update/1/status"},{"name":"versions","uri":"/rest/v1/SP/firmware/

update/1/versions"}]}

Special Considerations:

■ There is a limit of three active firmware update instances allowed at a given time.■ To remove a firmware update instance, use the DELETE command, for example:

curl -v --request DELETE -k -v -u "root:changeme" -H "Accept:application/json" https://IP addr:443/rest/v1/SP/firmware/update/1

■ Firmware update packages can take several minutes to upload depending on network speed.

Using the Oracle ILOM Web Service REST API 29

Page 30: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

View and Configure the Firmware Update Properties

View and Configure the Firmware UpdateProperties

1. To view the SP and BIOS component versions in the firmware update, see thefollowing command and respond examples:Command:

curl -v -k -v -u "root:changeme" -H "Accept:application/json" https://IP addr:443/rest/v1/SP/firmware/update/1/versions

Response:

{"Target":"/rest/v1/SP/firmware/update/1/versions","versions":[{"description":"

Service Processor Firmware","version":"4.0.1.0"},{"description":"Service

Processor BIOS","version":"19021300"}]}

2. To view the firmware update configuration questions and set properties, see thefollowing command and response examples:

Note - By default, all firmware update configuration properties are set to True.

Command:

curl -v -k -v -u "root:changeme" -H "Accept:application/json" https://IP addr:443/rest/v1/SP/firmware/update/1/questions

Response:

{"Target":"/rest/v1/SP/firmware/update1/questions","questions":[{"text":"

Preserve existing SP configuration","value":true},{"text":"Preserve existing

BIOS configuration","value":true},{"text":"Delay BIOS upgrade until next server

poweroff or reset","value":true}]}

3. To modify a set property for a specific firmware configuration question, see thefollowing command example:Command:

curl --request PATCH --data '{"questions":[{"text":"Preserve existing SP configuration","value":false}]}' -v -k -v -u "root:changeme" -H "Accept:application/json" https://IPaddr:443/rest/v1/SP/firmware/update/1/questions

30 Oracle ILOM Web Service Rest API • December 2017

Page 31: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Initiate the Firmware Update Installation and Poll the Status

Initiate the Firmware Update Installation and Pollthe Status

Note - Upon the completion of the firmware update process, the SP will automatically reset andbecome temporarily non-responsive.

1. To initiate the firmware update installation, see the following command example:Command:

curl --request PATCH --data '{"start":true}' -v -k -v -u "root:changeme" -H "Accept:

application/json" https://IP addr:443/rest/v1/SP/firmware/update/1

2. To poll the status of the firmware update while the installation is in progress, seethe following command and response examples:Command:

curl -v -k -v -u "root:changeme" -H "Accept:application/json" https://IP addr:443/rest/v1/SP/firmware/update/1/status

Response:

{"Target":"/rest/v1/SP/firmware/update1/status","state":"In Progress","

Component":"Service Processor Firmware","Component_progress":"20 of 26"}

Dump Full Console History Using the Oracle ILOM WebService API

To extract the entire console history to a binary (non-text) file using the Oracle ILOM WebService API, follow this step:

Note - The dump console history feature is not supported on multi-domain platforms, such asSPARC M-Series servers.

Type:curl -k --request PATCH -H "Content-type:application/json" --data '{"dump":true}' -u

username:password https://ip_address/file_path

Example:

Using the Oracle ILOM Web Service REST API 31

Page 32: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Dump Full Console History Using the Oracle ILOM Web Service API

curl -k --request PATCH -H "Content-type:application/json" --data '{"dump":true}' -u

root:changeme https://169.254.182.7/rest/v1/HOST/console/history

Related Information

■ Dump Console History to Remote Location, Oracle ILOM Administrator's Guide forConfiguration and Maintenance (Firmware 4.0.x)

32 Oracle ILOM Web Service Rest API • December 2017

Page 33: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

Security Considerations for Web Service RESTAPI

For REST API security considerations such as securing Oracle ILOM user access, see thefollowing information.

■ “Supported REST API Client Authentication Methods” on page 33

Supported REST API Client Authentication Methods

When using the Oracle ILOM Web Service REST API, the following two client authenticationmethods are supported:

■ Token Request Method – The token request method involves a POST request to the"/login" resource using the Oracle ILOM user credentials in the HTTP Authorizationheader. This token is used in subsequent requests to read and modify Oracle ILOM data.

■ Non-Token Request Mode – The non-token request method involves using Oracle ILOMuser credentials in the HTTP Authorization header directly in the request to read or modifyOracle ILOM data. A POST request to "/logout" with the token specified in the X-Rest-Token header will result in the immediate invalidation of the token. In addition, the tokenvalidity can be affected in several ways. The token life is tied to the HTTP session timeoutvalue. The Oracle ILOM HTTP session time out value defaults to 15 minutes of idle time.To modify the user session timeout value in Oracle ILOM, see "Default Timeout for CLIand Web Sessions" in the Oracle ILOM Administrator's Guide for Configuration andMaintenance Firmware Release 4.0

For additional information about Oracle ILOM authentication, see the following topics:

■ “Access and Authentication” on page 12■ “Securing Oracle ILOM User Access” in Oracle ILOM Security Guide For Firmware

Releases 3.x and 4.x.

Security Considerations for Web Service REST API 33

Page 34: Oracle ILOM Web Service Rest API Request With JSON Input Data Example ... Dump Full Console History Using the Oracle ILOM Web ... ILOM Web Service REST API to access and modify Oracle

34 Oracle ILOM Web Service Rest API • December 2017


Recommended