restclient

Syntax

restclient -uri URI options

restclient -type TYPE options

restclient -t

Description

Interacts with the local RESTful API service. The 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 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.

General options

-i FILE

Sends the contents of a specific file in the request contents.

-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, then 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 rest/v1 -g
      

To get the AdminName property from the BIOS resource:

Shell> restclient -uri rest/v1/Systems/1/Bios -g AdminName
      

To get the BIOS version from a ComputerSystem resource:

Shell> restclient -type ComputerSystem -g Bios/Current/VersionString
      

To set the AdminName property of the BIOS resource:

Shell> restclient -uri rest/v1/Systems/1/Bios/Settings -s AdminName=\"First Last
      

To send a POST request:

Shell> restclient -uri rest/v1/Systems/1 -m POST -i PostData.json