cancel
Showing results for 
Search instead for 
Did you mean: 

Restoring UCS archive using REST API

HarshadS
Altostratus
Altostratus

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:

{
    "code": 400,
    "message": "UCS loading process failed.",
    "errorStack": [],
    "apiError": 26214401
}

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)

 

 

2 REPLIES 2

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. 

HarshadS
Altostratus
Altostratus

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.