Reply

API Call to do save new dbsnapshot?

Techie
Posts: 9
7168     0

Is there an example API call to kick off a dbsnapshot?  I want to schedule hourly DB snapshots, if possible.  The entire gridmaster backup hourly was causing issues with API calls.  Im hoping the dbsnapshot will be a bit lighter and faster and will not cause interruption.

Re: API Call to do save new dbsnapshot?

Adviser
Posts: 181
7169     0

Hi,

 

You can a snapshot using the following WAPI:

curl -k -u username:password --location --request POST 'https://grid-masterwapi/v2.10/dbsnapshot?_function=save_db_snapshot' 
--header 'Content-Type: application/json' \
--data-raw '{
    "comment" : "Testing WAPI"
}'

Hope you find this helpful,

Krishna Vasudevan

Re: API Call to do save new dbsnapshot?

Techie
Posts: 9
7169     0

Thanks for the example but its returning a 404.

 

</head>
<body>
<div id="errorpage">
<div id="errorheader"><img src="./errorPage/ib_logo.png" alt="infoblox" /></div>

<div id="errortype">
<div id="errortitle"><h2><label>Page Not Found</label></h2></div>
</div>
<div class="ib-error-message">
<h3><br><br><label>Please enter a valid URL and try again. Contact Infoblox Technical Support if the problem persists.</label></h3>
</div>
</div>

</body>
</html>

Re: API Call to do save new dbsnapshot?

Adviser
Posts: 181
7169     0

Hi,

 

Could you please share the WAPI you are issuing?

 

Regards,

Krishna

Re: API Call to do save new dbsnapshot?

Techie
Posts: 9
7169     0

Using Postman:

 

 

Postman_ib_dbsnapshot404error.JPG

Re: API Call to do save new dbsnapshot?

Adviser
Posts: 181
7169     0

I am unable to see the image. Could you please try adding it as an attachment?

Re: API Call to do save new dbsnapshot?

Techie
Posts: 9
7169     0

It does not appear my screen shot is loading..... =/

 

 

using Postman:

 

POST  https://<labgridmaster>/v2.7.3/dbsnapshot?_function=save_db_snapshot

 

settings Headers in the Header section. 

 

getting the 'Page Not Found'  404 status error page from the Gridmaster.

Re: API Call to do save new dbsnapshot?

[ Edited ]
Adviser
Posts: 181
7169     0

Hi,

 

Could you please change the URL to

 

https://<labgridmaster>/wapi/v2.7.3/dbsnapshot?_function=save_db_snapshot

Re: API Call to do save new dbsnapshot?

Techie
Posts: 9
7169     0

That worked, but needed to make slight change to the params...

 

 

POST https://<labgirdmaster>/wapi/v2.7.3/dbsnapshot?_function=save_db_snapshot&comment="test wapi"

 

 

it returns a "_ref" as expected. 

Re: API Call to do save new dbsnapshot?

Techie
Posts: 9
7169     0

Here is what it looks like in Python.  Pretty simple.

 

 

 

#!/usr/bin/env python3
import http.client
import time

 

dt = time.strftime("%Y-%m-%d_%H.%M.%S")
fn = 'HourlySnapshot-{}'.format(dt)

 

conn = http.client.HTTPSConnection("<FQDN>")
payload = ''
headers = {
'Authorization': 'Basic <TOKEN>',
}


baseurl="/wapi/v2.7.3/dbsnapshot?_function=save_db_snapshot&comment="+fn


conn.request("POST", baseurl, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You