# Restoring UCS archive using REST API

**URL:** <https://community.f5.com/t/restoring-ucs-archive-using-rest-api/70022>\
**Category:** Technical Forums\
**Tags:** devops\
**Created:** [June 28, 2022, 5:46pm UTC](https://community.f5.com/t/restoring-ucs-archive-using-rest-api/70022 "2022-06-28T17:46:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HarshadS](https://avatars.discourse-cdn.com/v4/letter/h/977dab/32.png) [@HarshadS](https://community.f5.com/u/HarshadS)\
**Post date:** [June 28, 2022, 5:46pm UTC](https://community.f5.com/t/restoring-ucs-archive-using-rest-api/70022/1 "2022-06-28T17:46:40Z")

</div>

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:

{&nbsp;&nbsp;&nbsp;&nbsp;“code”:&nbsp;400,&nbsp;&nbsp;&nbsp;&nbsp;“message”:&nbsp;“UCS&nbsp;loading&nbsp;process&nbsp;failed.”,&nbsp;&nbsp;&nbsp;&nbsp;“errorStack”:&nbsp;[],&nbsp;&nbsp;&nbsp;&nbsp;“apiError”:&nbsp;26214401}

Any ideas what I’m doing wrong?

```python
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)

```

---

<div class="post-metadata">

**Author:** ![Enes\_Afsin\_Al](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/enes_afsin_al/32/15359_2.png) [@Enes\_Afsin\_Al](https://community.f5.com/u/Enes_Afsin_Al)\
**Post date:** [June 28, 2022, 10:57pm UTC](https://community.f5.com/t/restoring-ucs-archive-using-rest-api/70022/2 "2022-06-28T22:57:08Z")

</div>

Hi HarshadS,

Can you try this?

```tcl
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.

---

<div class="post-metadata">

**Author:** ![HarshadS](https://avatars.discourse-cdn.com/v4/letter/h/977dab/32.png) [@HarshadS](https://community.f5.com/u/HarshadS)\
**Post date:** [June 29, 2022, 12:34am UTC](https://community.f5.com/t/restoring-ucs-archive-using-rest-api/70022/3 "2022-06-29T00:34:21Z")

</div>

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.
