Skip to main content

API Corner: Pulling a backup from MSV

  • December 31, 2025
  • 0 replies
  • 6 views

James_R
Staff

The MSV UI calls API endpoints to do tasks, just as scripts can, if needed.

One task that I have been asked about is pulling a backup via a scripting language.

The endpoint for pulling a backup is GET /settings/create_backup.  It takes a parameter include_ssl_cert which can be true (to include the certificate) or false (to not include the server certificate).  Assuming one has variable for a requests Session (with correct authentication setup) and the hostname or IP address of your director, a segment of your code to pull a copy of the backup in Python 3 could look like the following:

endpoint = f'https://{DIRECTOR_IP}/settings/create_backup?include_ssl_cert=false'
with session.get(endpoint,stream=True) as response:
c = response.headers['content-disposition']
file_name = re.findall("filename=(.+)",c)[0]
file_name = file_name.replace('"',"")
with open(f'./{file_name}','wb') as f:
for chunk in response.iter_content(chunk_size=4096):
f.write(chunk)