Back up or activate a configuration
/rest/{version}/configuration/management
Request
-
version:
REST API version string.
Available values: v1.2
-
action:
Specifies which action to take with the configuration. Action can be to back up a configuration to a file from a particular configuration source, or activate the saved configuration.
Available values: backup, activate -
backupSource(optional):
Only valid when action is "backup". Specifies the source of the configuration to be backed up. When the action is "backup", both the "backupSource" parameter and "filename" parameter are required. The backupSource will specify which configuration is written to the backup file.
Available values: running, saved, editing -
filename(optional):
Only valid when action is "backup". Specifies the file name of the backup file. When the action is "backup", both the "backupSource" parameter and "filename" parameter are required. The filename parameter must be included and specify a valid backup filename that is not already present in the file system in the /code/bkups directory. Specifying an already existing filename will result in a failure.
-
Authorization:
The value in the Authorization header must be the string "
Bearer {access token}
", where{access token}
is a valid, unexpired token received in response to a prior/rest/{version}/auth/token
request.
Response
202 Response
400 Response
401 Response
403 Response
404 Response
423 Response
Examples
Example of Accessing the API with cURL
The following example shows how to back up or activate a configuration by submitting a POST request on the REST resource using cURL. For more information about cURL, see Use cURL.
curl -X POST \
--header "Accept: application/xml" \
--header "Authorization: Bearer $TOKEN" \
"https://${SBCIP}/rest/v1.1/configuration/management?action=backup&backupSource=running&filename=backupRunningConfig.gz"
Example of Accessing the API with Python
The following example shows how to back up or activate a configuration by submitting a POST request on the REST resource using Python. This example assumes you have a valid token stored in the token
variable. For an example of authenticating with Python, see Authenticate.
import requests
headers = { "Accept":"application/xml", "Authorization":"Bearer " + token }
url = "https://" + sbcip + "/rest/v1.1/configuration/management?action=backup&backupSource=running&filename=backupRunningConfig.gz"
resp = requests.post(url, headers=headers)
Example of the Response Body
The following example shows the contents of the response body in XML format.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
<data/>
<messages/>
<links>
<link>https://${SBCIP}/rest/v1.1/admin/asyncstatus</link>
</links>
</response>
After receiving that response, check the status of the asynchronus action by making a GET request to the /rest/v1.1/admin/asyncstatus endpoint.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
<data>
<operationState>
<operation>backup</operation>
<status>success</status>
</operationState>
</data>
<messages/>
<links/>
</response>