Forum Discussion
use rest api create ucs archive
Hello: I want to use rest api create ucs archive ,and send to my external storage ; Can you give me the python code .
import requests import json import urllib3 urllib3.disable_warnings()
bigip_ip='20.42.1.51' bigip_username='admin' bigip_password='admin'
resp =requests.post/mgmt/tm/sys/ucs -d '{"command":"save","name":"/var/local/ucs/test.ucs"}'
print resp
- Lee_Sutcliffe
Nacreous
You can use an asynchronous task to create a UCS using REST
From the 13.0 REST API User Guide: https://devcentral.f5.com/d/icontrolr-rest-api-user-guide-version-1300-241
curl -X POST \ https://192.168.25.42/mgmt/tm/task/sys/ucs \ -H 'Content-Type: application/json' \ -H 'X-F5-Auth-Token: ABCDEFG' \ -d ' { "command": "save", "name": "myUcs" } '
Using Python (3) You could use the following (code generated by Postman):
import http.client conn = http.client.HTTPConnection("192,168,25,42") payload = "{\"command\": \"save\",\"name\": \"myUcs\"}" headers = { 'X-F5-Auth-Token': "ABCDEFG", 'Content-Type': "application/json", } conn.request("POST", "mgmt,tm,task,sys,ucs", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com