Top
Systemwalker Runbook Automation Reference Guide
Systemwalker

3.6.1 Perform REST-based communication

Description

This operation component performs REST-based communications on hosts.

Options

Basic Options

(1) hostname

Host name or IP address of the host performing REST-based communications.

To perform REST communication with Management Server, specify the following:

  • For IPv4: 'localhost' or '127.0.0.1'

  • For IPv6: 'localhost' or '::1'

An argument error occurs if the host name or IP address is omitted.

The maximum length of the host name or IP address is 1,024 characters. An argument error occurs if this is exceeded.

(2) methodname

Method name of HTTP (HTTPS) to be executed.

Specify GET, POST, PUT, and DELETE. Use uppercase letters.

An argument error occurs if the method name is omitted.

The maximum length of the methodname is 1,024 characters. An argument error occurs if this is exceeded.

(3) resourcepath

Path of the resource to be used.

An argument error occurs if the resource path is omitted.

The maximum length of the path is 1,024 characters. An argument error occurs if this is exceeded.

Specify the resource path as follows:

For example:

/webdav/index.html

If the HTTP (or HTTPS) method to be executed is POST, PUT, or DELETE, the arguments for the resource to be used can be specified as follows.

  • Use a question mark ("?") to separate the resource path from the arguments.

  • Specify an argument using the <argument name>=<argument value> format. To specify multiple arguments, separate each argument with an ampersand ("&") as shown below.

Example: /webdav/index.html?label1=value1&label2=value2

(4) param

Specify the argument names and values for the resource to be used.

Specify this option if the HTTP (or HTTPS) method to be executed is "GET".

If the argument name and argument value are omitted, REST communication will be performed without an argument.

The maximum lengths of the argument name and the value of the argument are 1,024 characters. An argument error occurs if this is exceeded.

The specified argument name and value are converted to the UTF-8 character encoding before communications are performed.

Specify the argument name and the argument value as "Argument name = Argument value". Separate with "&" to specify more than one.

For example:

label1=value1&label2=value2

If the HTTP (or HTTPS) method to be executed is "POST" or "PUT", the specified value is stored in the body as a request.

Example: label1=value1&label2=value2

To specify requests with other formats, specify the "requestxml" option.

If the HTTP (or HTTPS) method to be executed is "DELETE", this option is ignored even if specified.

Advanced Options

(1) port

Port number of the host performing REST-based communications.

Specify the port number using an integer between 0 and 65535.

If port number is omitted, 80 is specified.

(2) basicusername

Name of the user who performs BASIC authentication.

If the user name is omitted, then REST communication will be performed without BASIC authentication.

The maximum length of the user name is 1,024 characters. An argument error occurs if this is exceeded.

(3) basicpassword

Password of the user who performs BASIC authentication.

If the password is omitted, then REST communication will be performed without BASIC authentication.

The maximum length of the password is 1,024 characters. An argument error occurs if this is exceeded.

(4) element

Address of the element name to analyze the execution results (XML) of REST-based communications.

A text string matching the address (xpath) specified in 'element' is extracted from the text in the execution results XML file, and then output.

If there are multiple instances of elements matching the conditions, elements are enclosed in double-quotes and separated by commas for output.

For example: If the data is "element A", "element B 'C, D'": "element A", "element B ""C,D"""

An error occurs if the corresponding element doesn't exist.

Execution results of REST-based communications are output as XML if element names are omitted.

The maximum length of the element name is 1,024 characters. An argument error occurs if this is exceeded.

Specify element name addresses as follows:

For example: /response/params/item

(5) proxy

Address of the proxy server.

Communication without a proxy server is performed if the proxy server address is omitted.

The maximum length of the address is 1,024 characters. An argument error occurs if this is exceeded.

(6) proxyport

Port number of the proxy server.

Specify the port number using an integer between 0 and 65535.

If port number is omitted, 8080 is specified.

(7) protocoltype

Protocol type for performing REST communication.

Specify http or https. Use lowercase letters.

If protocol type is omitted, http is specified.

The maximum length of the protocol type is 1,024 characters. An argument error occurs if this is exceeded.

(8) requestxml

This option contains parameters for REST-based communications.

A maximum of 2,048 characters can be specified as parameters of REST communications. An argument error occurs if this limit is exceeded.

The specified parameter is converted to the UTF-8 character encoding before communications are performed.

If this option is omitted, the specification for the "param" option will take effect.

If the HTTP (or HTTPS) method to be executed is "GET"

Specify the argument names and argument values for the resource to be used.

Specify the argument name and value to be passed to the resource using the <argument name>=<argument value> format shown below. To specify multiple values, specify each value separated by ampersands (&).
Example:

label1=value1&label2=value2
If the HTTP (or HTTPS) method to be executed is "POST" or "PUT"

Specify the request to be stored in the body with REST communications.

To specify a request in the text format, specify as shown below.
Example:

UDA1=value1
UDA2=value2

To specify a request in the XML format, specify as shown below.
Example:

<request>
  <data>1234</data>
</request>
If the HTTP (or HTTPS) method to be executed is "DELETE"

The specification of this option is ignored.

(9) contenttype

The data format (MIME type) used in REST communication.

If the data format is omitted, application/x-www-form-urlencoded will be specified.

In addition to data formats, character sets can be specified for contenttype.

Specify data formats and character sets as follows:

Example of specifying data formats: application/xml

Example of specifying data formats and character sets: application/xml; charset=utf-8

The maximum length of the content type is 1,024 characters. An argument error occurs if this is exceeded.

(10) accepttype

The data format (MIME type) that can be received in REST communication.

If the data format is omitted, no data format will be specified. In this case, the format of the received data will follow what is specified for the communication destination.

The maximum length of the data format is 1,024 characters. An argument error occurs if this is exceeded.

Specify XML format requests as follows:

For example: text/plain

(11) timeout

This is the completion timeout (seconds) for the execution of operation components.

Values between 300 and 86400 (1 day) can be specified.

For example: When timeout is to occur every 10 minutes: 600

When the execution of the operation components is not completed even if the specified time passes, the processing of the operation components is interrupted in return value 201.

(12) retry

This is the retry count for the execution of operation components.

When the operation components end in return value 161, the retry count is specified. Values between 0 and 5 can be specified.

As a result of retrying, if the operation components ended by the return values other than 161, the execution of the operation components ends even if it doesn't reach the specified retry count. The return values of the operation components become the value executed at the end.

For example: When retries are to be performed twice: 2

(13) retry_interval

This is the retry interval (seconds) for operation components.

When the operation components end in return value 161, the retry interval is specified. Values between 1 and 14400 can be specified.

For example: When retrying in 300 seconds: 300


If the specification of the timeout, retry and retry_interval is omitted, and a value beyond the limits of the above-mentioned is input, the value specified with the operation components definition file becomes effective. Refer to "2.5 Definition File for Operation Components" for details.

Return Values

Icon

Name

Return value

Description

Success

0

REST communication was successful.

Failure

161

REST communication failed. Retried if a retry count has been specified.

176

An element corresponding to 'element' does not exist.

188

Connection failed during execution.

189

An attempt to connect to the server has failed.

197

There is an error in the option content.

-

-

201

Execution of operation component timed out.

202

The operation component was not executed. There is a problem in the setting to execute operation components.

203

Failed to execute the operation component. There is a problem in the Operation Automation Server environment.

205

The operation component was not executed. There is a problem with the input information specification of the operation components.

206

The operation component was not executed normally. There is a problem with the output information specification of the operation component.

207

The operation components were not executed. There is a possibility that the operation components are not registered in the Management Server.

208

The Automated Operation Process has been canceled because the Automated Operation Process was recovered while the operation component was executing.

Output information

Variable

Description

message

This variable will be set to the following message if REST-based communications are successful.

The operation component was successful.

If REST-based communications fails, the content of the error will be output as a string.

rest_communication_result

This variable is set to the execution result, using either a string or an XML format string.

returnCode

This variable is set to the return value.

Notes