Create or update system variables

Use this operation to create or update z/OSMF system variables in the system variable pool.

HTTP method and URI path

POST /zosmf/variables/rest/<version>/systems/<sysplex-name>.<system-name>
In this request, the URI path variables are described, as follows:
  • <version> identifies the version of the z/OSMF system variables service. The following value is valid: 1.0.
  • <sysplex-name> identifies the sysplex.
  • <system-name> identifies the system.

Description

This operation creates or updates system variables specified in the request body. If the system variable pool does not exist, this operation creates the pool and adds the variables to it. If there is no request body and the pool does not already exist, the operation creates an empty pool. If there is no request body and the pool already exists, no action is taken. If a variable appears in the request body multiple times, the value of the last occurrence is used as the value of the variable.

On successful completion, HTTP status code 204 (No content) is returned, indicating that the system variables were created or updated with the new value.

Authorization requirements

Use of this API requires READ access to the following resource profile in the ZMFAPLA class: ZOSMF.VARIABLES.SYSTEM.ADMIN.

See also Authorization requirements.

Request content

The request content is expected to contain an array of JSON objects. See Table 1 and Table 2. A request with no request body creates an empty pool if the pool does not already exist.
Table 1. Request content for the create or update system variables request
Field name Type Description
system-variable-list Array of objects List of variables to be added or updated to the system variable pool.
Table 2. Fields in a JSON object for the create or update system variables request
Field name Type Required or optional Description
name String Required Descriptive name for the variable
value String Required Value for the variable
description String Optional Description of the variable

HTTP status codes

On successful completion, HTTP status code 204 (no content) is returned.

Otherwise, the following HTTP status codes are returned for the indicated errors.

Table 3. HTTP error response codes for a create or update system variables request
HTTP error status code Description
400 The request is missing a required property or the value of the property was null or empty, or the JSON request is incorrectly formatted.
401 Submitter of the request is not authorized to invoke the task to create the system variables.
404 Requested sysplex-name.sysname-name was not found.
404 Requested system-name was not found.
500 A server error occurred during processing of the request.

Response content

None.

Example HTTP interaction

In the following example, the POST method is used to create the system variables.
Figure 1. Sample request to create system variables
POST /zosmf/variables/rest/1.0/systems/TESTPLEX.TESTNODE
The request body is as follows:
Figure 2. Sample request body for a create system variables request
{"system-variable-list": [
{"name" : "var1","value":"value1","description":"description of the variable"},
{"name" : "var2","value":"value2","description":"description of the variable"}]}