Are you interested in our Early Access Program (EAP)? This program allows you to preview code, test in your lab and provide feedback prior to General Availability (GA) release of all Infoblox products. If so, please click the link here.

API Examples

Who Me Too'd this solution

Re: Looking for a WAPI API to do upgrade of members and Grid.
Adviser
Posts: 179
This widget could not be displayed.
This widget could not be displayed.

Hi,

 

You can use the following list of WAPI calls. These are a sample set. Please change the credentials and IP address according to yout environment.

 

Export a database backup

Initiate backup:
curl -k -u admin:Infoblox -H 'content-type: application/json' -X POST "https://127.0.0.1/wapi/v2.9/fileop?_function=getgriddata" -d '{"type": "BACKUP"}'

Sample output:
{"token": "eJydUE1PwzAMvfuPjMvaplvWjdtQmYSENmlD4mi1STos2iQkGdr+PQ4SnDhxSOT4fcR+Sjl/w2DO\nwJdyNqZwUckF8ALuFNnB9aO7Fs6afNLNmwhtlzo8mgF8DQqxv9CYyCKCJpXAL+BO+yWcZubqKdww\n0WRm4CXshKxkI+W6XhWyqZayhniaXcLI6Ir5byn5eF+WoqkLpoiiLnMLNfFoCQcaDZIrg/lA0vP2\n8Lp/PmzbuagqUWqeqe+iKfrune2a7EyaqzUb/6VgaJNJWci1qJhXRt68O5syTf7fXwvxY4vGKqfJ\nnnO3Zv+Hp30uF7+EyekcjchptduXLR4fd/ktIaajF6ucpGgYHMiMOmJyqNzku/CtWsM+b9l3Hsn6\nS8JPEyI5m7ENY33xBbQAllA=\n",
 "url": "https://127.0.0.1/http_direct_file_io/req_id-DOWNLOAD-1001/database.bak"
}

Download the backup:
curl -k -u admin:Infoblox -H 'content-type: application/force-download' "https://127.0.0.1/http_direct_file_io/req_id-DOWNLOAD-1001/database.bak" -o "database.bak"

Remove the stored file using the token:
curl -k -u admin:Infoblox -H 'content-type: application/json' -X POST "https://127.0.0.1/wapi/v2.9/fileop?_function=downloadcomplete" -d '{"token" : "eJydUE1PwzAMvfuPjMvaplvWjdtQmYSENmlD4mi1STos2iQkGdr+PQ4SnDhxSOT4fcR+Sjl/w2DO\nwJdyNqZwUckF8ALuFNnB9aO7Fs6afNLNmwhtlzo8mgF8DQqxv9CYyCKCJpXAL+BO+yWcZubqKdww\n0WRm4CXshKxkI+W6XhWyqZayhniaXcLI6Ir5byn5eF+WoqkLpoiiLnMLNfFoCQcaDZIrg/lA0vP2\n8Lp/PmzbuagqUWqeqe+iKfrune2a7EyaqzUb/6VgaJNJWci1qJhXRt68O5syTf7fXwvxY4vGKqfJ\nnnO3Zv+Hp30uF7+EyekcjchptduXLR4fd/ktIaajF6ucpGgYHMiMOmJyqNzku/CtWsM+b9l3Hsn6\nS8JPEyI5m7ENY33xBbQAllA=\n"}'

Restore database:

Initiate file upload:
curl -k -u admin:Infoblox -H 'content-type:application/json' -X POST "https://127.0.0.1/wapi/v2.9/fileop?_function=uploadinit"

Sample output:
{"token": "eJydUMFOwzAMvftHymVt09Fu5TY0JiGhgTY4W22SDkttYpIUbX9PMgQXbhwS2X7PL3lPSssXdPoE\n8ZLW+OBmGawDFnAjyQy2H+05t0anEy6sPWy70OFBD8AVSMR+pjGQQQRFMgAv4UbxLRwzfWZyFww0\n6Qy4hp2oy3pVN1XT5GXZtmIF/pjNboxoE/nvIbC/KwqxqvKqyUVeFWmEiuLXAg40aiRbOP2BpBZv\nL0/Pm+1ClKUoaGLrvhlR6ypLKlbrqPqXHoE2UVT0EWtRRlbho+nupIsw8f9eFeJHE7WRVpE5pWkV\nxe8f96lc/hImq64rKaXt5nWDh4dd6mvw4cCiSQnGdI7ZQHpUHoNFaSfu3HVrDftksO8YyfAc8FM7\nT9YkrI1Yn38Bt1KUqw==\n",
 "url": "https://172.26.1.2/http_direct_file_io/req_id-UPLOAD-1001/import_file"
}

Upload the database backup file:
curl -k -u admin:Infoblox -H 'content-type:multipart-formdata' "https://127.0.0.1/http_direct_file_io/req_id-UPLOAD-1001/import_file" -F file=@database.bak

Restore the database:
curl -k -u admin:Infoblox -H 'content-type:application/json' -X POST "https://127.0.0.1/wapi/v2.9/fileop?_function=restoredatabase" -d '{"mode":"NORMAL","token":"eJydUMFOwzAMvftHymVt09Fu5TY0JiGhgTY4W22SDkttYpIUbX9PMgQXbhwS2X7PL3lPSssXdPoE\n8ZLW+OBmGawDFnAjyQy2H+05t0anEy6sPWy70OFBD8AVSMR+pjGQQQRFMgAv4UbxLRwzfWZyFww0\n6Qy4hp2oy3pVN1XT5GXZtmIF/pjNboxoE/nvIbC/KwqxqvKqyUVeFWmEiuLXAg40aiRbOP2BpBZv\nL0/Pm+1ClKUoaGLrvhlR6ypLKlbrqPqXHoE2UVT0EWtRRlbho+nupIsw8f9eFeJHE7WRVpE5pWkV\nxe8f96lc/hImq64rKaXt5nWDh4dd6mvw4cCiSQnGdI7ZQHpUHoNFaSfu3HVrDftksO8YyfAc8FM7\nT9YkrI1Yn38Bt1KUqw==\n"}'

Upgrade a member:

Get the grid reference:
curl -k -u admin:Infoblox -X GET "https://127.0.0.1/wapi/v2.9/grid"

Sample output:
{"result": 
  [{"_ref": "grid/b25lLmNsdXN0ZXIkMA:Infoblox"}]}

Upgrade a member:
curl -k -u admin:Infoblox -H 'content-type: application/json' -X POST "https://127.0.0.1/wapi/v2.9/grid/b25lLmNsdXN0ZXIkMA:Infoblox?_function=member_upgrade" -d '{"member": "infoblox.localdomain"}'

Hope you find this helpful,

Krishna

View solution in original post

Who Me Too'd this solution