When working with the REST interface that is provided for a Web Gateway appliance, you send requests to this interface to have particular activities completed.
You can send single HTTP or HTTPS requests that are immediately processed or run these requests in a script, for example, in a bash script. The latter is the typical use.
You can also send requests for completing activities on other appliances that are connected as nodes in a Central Management cluster to the appliance where you are working
Requests are sent using a client of the appliance, which in turn provides a server for processing the requests and sending responses. You are assigned a particular amount of work space on this server. For some types of changes, you also need to send a commit request.
As this client, you can- use a data transfer tool, for example, curl (Client for URLs).
Before you can send requests for completing any activities, you must log on to the REST interface, authenticate and receive a session ID.
The REST interface is provided in a particular format known as the ATOM format.
Sample script for sending a request
The following is an example of a bash script that sends a request to the REST interface using curl. The purpose of the request is to create a configuration backup.
The script does basically the following:
- Logs on and authenticates to the REST interface on an appliance
- Sends a request to create a backup file
- Logs off again
The script also uses a variable for the URL that is specified in the request for logging on to the REST interface. The variable is set at the beginning.
When a sample command or a script with commands is shown in this documentation, a command can extend over two or more lines. When working with the REST interface, you must enter any command completely within a single line.
#!bin/bash ## Set URL variable for access to REST interface REST="http://localhost:4711/Konfigurator/REST" ## Log on and authenticate curl -c cookies.txt -H "Authorization: Basic YWRtaW46d2ViZ2F0ZXdheQ==" -X POST "$REST/login" ## Create backup file curl -b cookies.txt -X POST "$REST/backup" -o filename.backup ## Log off again curl -b cookies.txt -X POST "$REST/logout"