restclient
Syntax
restclient -uri
URI
[options]
restclient -type
TYPE
[options]
restclient -t
restclient -time
Description
Interacts with the local RESTful API service. The
restcli
command is an internal alias for this command.
Resource selection options
-uri URI
Requests a resource from a specific URI.
-type TYPE
Returns a resource matching the specific base type, if one exists.
Actions
-m METHOD
Sends the HTTP request using a specified method. Valid values are:
GET/POST/PUT/PATCH/DELETE.
-g [PROPERTY...]
Gets the entire resource, or a specific property within the resource.
-m GET
is implied by this option.-s PROPERTY=VALUE
Specifies a value for a resource property.
-m PATCH
is implied by this option, and request contents are automatically generated.-t
Lists all resource types.
-time
Displays the RESTful time in ISO 8601 UTC format.
General options
-i FILE
Sends the contents of a specific file in the request contents.
-o FILE
Writes a JSON response body to the specified file using ASCII encoding. Only valid for GETs of the entire resource (
-g
or-m GET
), ignored otherwise. Use this argument when the resource is larger than 16Kb.-c
Uses cached content for GET requests when possible. This option improves performance, but might return stale data.
Usage
URIs must start with the root resource, without a leading slash. For example:
rest/v1/Systems
.
TYPE
is a string in the form of
TypeName.X.Y.Z
, where
X, Y, Z
are major, minor, and errata type versions, respectively. If some (or all) version specifiers are omitted, wildcard matching is used instead. Additionally,
TYPEs
that specify minor and errata versions also match resources with greater values because those are backward compatible.
PROPERTY
is case-sensitive, and nested properties can be selected by adding '/' delimiters. The
-s
option cannot accept nested properties.
VALUE
can represent JSON (objects, arrays, null, etc.). Quotes are not necessary for string values, except to preserve white space.
The contents of
FILE
must be valid JSON.
Examples
To get the root resource:
Shell> restclient -uri redfish/v1 -g
To get the
AdminName
property from the
BIOS
resource:
Shell> restclient -uri redfish/v1/Systems/1/Bios -g Attributes/AdminName
To get the
iSCSIInitiatorName
property from the
iScsi
resource:
Shell> restclient -uri redfish/v1/Systems/1/Bios/iScsi -g iSCSIInitiatorName
To get the system ROM version from a
ComputerSystem
resource:
Shell> restclient -type ComputerSystem -g Oem/Hpe/Bios/Current
To set the
AdminName
property of the
BIOS
resource:
Shell> restclient -uri redfish/v1/Systems/1/Bios/Settings
-s Attributes/AdminName=\"First Last\"
To set the
iSCSIInitiatorName
property of the
iScsi
resource:
Shell> restclient -uri redfish/v1/Systems/1/Bios/Settings
-s iSCSIInitiatorName=\"InitiatorName\"
To send a
POST
request:
Shell> restclient -uri redfish/v1/Systems/1 -m POST -i PostData.json
To write a response body to a file:
restclient -uri redfish/v1/Managers/1 -m GET -o Managers1.json