28-Jun-2022 10:46
Hi,
I was trying to figure out how to load an already uploaded UCS archive on bigip ltm using the rest API. The UCS file exists in /var/local/ucs and I'm trying to load it as shown below in the code sample but getting this as response:
Any ideas what I'm doing wrong?
import requests
import json
url = "https://<mgmtip>/mgmt/tm/sys/ucs"
payload = json.dumps({
"command": "load",
"name": "/var/local/ucs/myucsfile.ucs"
})
headers = {
'X-F5-Auth-Token': '<token>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
28-Jun-2022 15:57
Hi HarshadS,
Can you try this?
import requests
import json
url = "https://<mgmtip>/mgmt/tm/shared/sys/backup"
payload = json.dumps({
"file":"myucs.ucs",
"action":"RESTORE",
"generation":0,
"lastUpdateMicros":0
})
headers = {
'X-F5-Auth-Token': '<token>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
I didn't test it.
28-Jun-2022 17:34
Thanks for the reply - i think I found that my issue was the version of OS where the UCS was obtained from was different than the OS Version I was trying to import into - once I fixed that, the import worked with the same command I had.