Now Available - Forrester's Total Economic Impact study. Discover millions in cost savings, unlock IT efficiency gains, and explore why NIOS DDI is a game changer. Get Your Copy here.

API & Integration, DevOps,NetOps,SecOps


API call to retrieve Backup DB

New Member
Posts: 2
225     0

Hi all and thanks in advance for any replies.


First time poster, long time subscriber.


Anyway, I am trying to retrieve the Backup DB .csv via api but keep getting the below error

C:\Users\e157716\PycharmProjects\SunchProdAndDev\venv\lib\site-packages\urllib3\ InsecureRequestWarning: Unverified HTTPS request is being made to host ''. Adding certificate verification is strongly advised. See:
Error creating a database backup: 400

Process finished with exit code 0

My code is as follows:

import requests

# Infoblox API information
infoblox_url = 'xxx' # Adjust the URL and version as needed
infoblox_user = 'yyy'
infoblox_password = 'zzz'

# Function to create an Infoblox database backup
def create_database_backup():
endpoint = '/grm/backup'
url = infoblox_url + endpoint

# Prepare a request to create a database backup
data = {
"comment": "Database backup created via API" # Optional comment

response =, auth=(infoblox_user, infoblox_password), json=data, verify=False) # Disable SSL verification; use it with caution

if response.status_code == 200:
response_data = response.json()
backup_url = response_data['url']

# You can download the backup file if needed
# backup_response = requests.get(backup_url, auth=(infoblox_user, infoblox_password), verify=False)
# Handle the downloaded backup file as required
print("Database backup created successfully.")
print(f"Error creating a database backup: {response.status_code}")

if __name__ == "__main__":

We are running: 8.6.3-51135-1241097029df

Re: API call to retrieve Backup DB

Posts: 267
226     0

Looks like your grid is using self-signed certificates. That's not a problem but you will need to set up a requests session, and supply some parameters to bypass SSL certificate validation.


Here's a quick example of setting up a session, and getting the current WAPI version

global SESSION
SESSION = requests.session()
get_version = f'https://{gm}/wapi/v1.0/?_schema'
json_headers = {'content-type': 'application/json'}

resp = SESSION.get(get_version, headers=json_headers,

json_data = json.loads(resp.text)

# Save the authentication cookie for use in subsequent requests.
ibapauth_cookie = resp.cookies['ibapauth']

# Use the ibapauth cookie to authenticate instead of userid/password.
global COOKIE
COOKIE = {'ibapauth': ibapauth_cookie}

# Get supported versions
versions = json_data["supported_versions"]
versions.sort(key=lambda s: list(map(int, s.split('.'))))  # Sort Versions

# Get the latest version
global WAPI
WAPI = versions[-1]"Using wapi version %s", WAPI)"Capturing supported objects for version %s", WAPI)

You will need to generate the backup file first, using the fileop function.


Here's an example with curl. 

# Download Grid Backup

# Request grid backup generation

curl -k -u admin:infoblox -X POST ''

    "token": "eJytjj0LwjAURf9KyWyTvrSExq1SBUFaEMExpE2swX6ZRlDE/24z6Ori+M7lnnefSN9HYx/CmU6j\nZQCMp8CiNKaYA0toxBcButl2jtDZuXFaEgKcYmApBkyJZ0IZq2snTqbVwgzE6qswKszLY7ErszyE\niCYwq2LKIWFRTJR0spKTxpW8oNnvb6H7elCmb/yn1bb48m5QfhjKs0Mm9uvNJ/CMTG6wstHEdeN/\nphjlvb9q6PUGzdpb/w==\n", 
    "url": ""

# Download file from URL

curl -k -u admin:infoblox -H "Content-type:application/force-download" -O ''
# And then close the file using the token
curl -k1 -u admin:infoblox -X POST '' \
-H "Content-Type: application/json" -d \
  "token": "eJytjj0LwjAURf9KyWyTvrSExq1SBUFaEMExpE2swX6ZRlDE/24z6Ori+M7lnnefSN9HYx/CmU6j\nZQCMp8CiNKaYA0toxBcButl2jtDZuXFaEgKcYmApBkyJZ0IZq2snTqbVwgzE6qswKszLY7ErszyE\niCYwq2LKIWFRTJR0spKTxpW8oNnvb6H7elCmb/yn1bb48m5QfhjKs0Mm9uvNJ/CMTG6wstHEdeN/\nphjlvb9q6PUGzdpb/w==\n"



Re: API call to retrieve Backup DB

New Member
Posts: 2
226     0
Wow, thanks for the quick reply.

Could I have an example with Pythin?

[Image result for Southwest Airlines heart clipart]


This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete this message from your system. Thank you.
Showing results for 
Search instead for 
Did you mean: 

Recommended for You