Working on appliances
After logging on to the REST interface on one appliance, you can complete activities on any other appliance that is connected. You can also complete some activities on all appliances at once. An activity that is completed on all appliances at once is, for example, to import a license for all of them.
Individual appliances are identified in requests by their UUIDs (Universal Unique Identifiers)
The UUID of an appliance looks like this: 081EEDBC-7978-4611-9B96-CB388EEFC4BC
To find out about the UUID of an appliance, you can request a feed of all appliances that are connected as nodes in a Central Management cluster to the one where you are currently working.
The feed that is sent in response to your request includes a list of the UUIDs for all nodes. You can then identify an appliance by its UUID and, for example, shut down this appliance.
Importing a license
Request format: <URL>/appliances/license
To import a license onto the appliances that are connected in a Central Management cluster, use the appliances and license parameters in a request.
You also need to specify a Content-Type header for the type of the license file.
Sample command: curl -i -b cookies.txt " -H "Content-Type: text/plain; charset=UTF-8" -X POST "$REST/ appliances/license" --data-binary @license.xml
Requesting a feed with UUIDs for all appliances
Request format: <URL>/appliances
To request a feed with a list of UUIDs for all appliances that run as nodes in a cluster, use the appliances parameter.
Sample command: curl -i -b cookies.txt -X GET "$REST/appliances"
Request parameters: None
Requesting a page in a feed for all appliances
Request format: <URL>/appliances?page=<int>&pageSize=<int>
To request a particular page in a feed for all appliances that run as nodes in a cluster, use the appliances parameter with a page parameter appended. You can also append another parameter to request a particular page size.
Sample command: curl -i -b cookies.txt -X GET "$REST/appliances?page=3&pageSize=2"
Parameter | Type | Description |
---|---|---|
page | Integer | Number of the page in a feed for all appliances Default: 1 |
pageSize | Integer | Size of the page in a feed for all appliances Default: –1 |
Actions
Actions that are performed on individual appliances are specified in a request by their names, which are preceded by the action parameter.
These actions do not involve a modification of resources and are performed instantly, which means no request to commit them is required.
You can perform the following actions:
- restart — Restart an appliance
- shutdown — Shut down an appliance
- flushcache — Flush the cache
- rotateLogs — Rotate log files
- rotateAndPushLogs — Rotate and push log files
- license — Import a license
Restarting an appliance
Request format: <URL>/<UUID>/action/restart
To restart an appliance, use restart as the action name in a request.
Sample command: curl -i -b cookies.txt -X POST "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC /action/restart"
Request parameters:
Parameter | Type | Description |
---|---|---|
UUID | String | UUID of the appliance that you want to restart Default: None |
Shutting down an appliance
Request format: <URL>/<UUID>/action/shutdown
To shut down an appliance, use shutdown as the action name in a request.
Sample command: curl -i -b cookies.txt -X POST "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC /action/shutdown"
Request parameters:
parameter | Type | Description |
---|---|---|
UUID | String | UUID of the appliance that you want to shutdown Default: None |
Flushing the cache
Request format: <URL>/<UUID>/action/flushcache
To flush the cache on an appliance, use flushcache as the action name in a request.
Sample command: curl -i -b cookies.txt -X POST "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC /action/flushcache"
Request parameters:
parameter | Type | Description |
---|---|---|
UUID | String | UUID of the appliance where you want to flush the cache Default: None |
Rotating log files
Request format: <URL>/<UUID>/action/rotateLogs
To rotate the log files on an appliance, use rotateLogs as the action name in a request.
Sample command: curl -i -b cookies.txt -X POST "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC /action/rotateLogs"
Request parameters:
parameter | Type | Description |
---|---|---|
UUID | String | UUID of the appliance where you want to rotate log files Default: None |
Rotating and pushing log files
Request format: <URL>/<UUID>/action/rotateAndPushLogs
To rotate the log files on an appliance and push them to a remote server, use rotateAndPushLogs as the action name in a request.
Sample command: curl -i -b cookies.txt -X POST "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC /action/rotateAndPushLogs"
Request parameters:
parameter | Type | Description |
---|---|---|
UUID | String | UUID of the appliance where you want to rotate and push log files Default: None |
Sample script for working on individual appliances
The following bash script rotates logs as an example for completing an action on an individual appliance.
Before this action is completed, the script sets a URL variable for accessing the REST interface.
#!/bin/bash ## Set URL variable for accessing REST interface REST=http://localhost:4711/Konfigurator/REST ## Log on and authenticate curl -i -c cookies.txt -X POST "$REST/login?userName=myUserName&pass=myPassword" ## Rotate log files curl -b cookies.txt -X POST "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC /action/rotateLogs" ## Log off again curl -b cookies.txt -X POST "$REST/logout"