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


Retrieve "Pending Changes" via API?

Posts: 10
2325     0

To all the InfoBlox API Experts here ...


Is there a way to retrieve a list of "Pending Changes" via API? Via "console - restart services", you can see a list of pending changes. I'd like to get access to that data via API so that I can pull and store it in a Change Control / Incident Ticket prior to issuing an automated restart, but I've been unsuccessful so far. Smiley Sad


Thank you!

Re: Retrieve "Pending Changes" via API?

[ Edited ]
Posts: 81
2326     0

Hello There,


So there's no direct call to pull outstanding changes to be processed. But here's a python script that will let you pull changes since a specific EPOCH time. For example, if you want to pull all changes since the last time you know a restart was done(Say June 1, 2021 5:30:00 AM GMT), then your input EPOCH time input to the script would be : 1622505600.


This website will help you with the Date-Epoch conversion. Just put in the date there & get the epoch value -> put this in as the input when you run the script. 


Sample output :


  **Changes since Thu Jul 15 17:23:20 2021 **

"_ref": "grid:servicerestart:request:changedobject/b25lLnJlc3RhcnRfcmVxdWVzdF9jaGFuZ2VkX29iamVjdCQxMTI:changedobject",
"action": "CREATED",
"changed_time": 1626374119,
"object_name": "",
"object_type": "zone_auth",
"user_name": "admin"
"_ref": "grid:servicerestart:request:changedobject/b25lLnJlc3RhcnRfcmVxdWVzdF9jaGFuZ2VkX29iamVjdCQxMTM:changedobject",
"action": "CREATED",
"changed_time": 1626378655,
"object_name": "",
"object_type": "zone_auth",
"user_name": "admin"

Code :


# Find pending changes since X time in epoch.

import requests
import urllib3
import json
from os import system, name
import datetime

def clear():
    if name == 'nt':
        _ = system('cls')
        _ = system('clear')


gm_ip = input("\n\nEnter Grid Mater's IP :")
gm_user = input("\nEnter user name :")
gm_password = input("\nEnter password :")

epoch_start_time = input("\nEnter the start of Epoch :")
urL = 'https://' + gm_ip + '/wapi/v2.9/grid:servicerestart:request:changedobject?_return_fields=action,object_name,changed_time,object_type,user_name'

response = requests.get(urL, auth=(gm_user, gm_password), verify=False)
mid_value = response.content
response_native = json.loads(mid_value)

time_value = datetime.datetime.fromtimestamp(int(epoch_start_time)).strftime('%c')
print(f"\n\t\t**Changes since {time_value} **")

for change in response_native:
    if float(change['changed_time']) > float(epoch_start_time):
        readable_dictionary = json.dumps(change, indent=2)

I've tested & verified changes back till June 1, 2021. Hope this would help


Best regards,


Re: Retrieve "Pending Changes" via API?

Posts: 10
2326     0

Fantastic. Thank you! This got me what I needed.


Running several tests on my GRID, this call *does* appear to only pull outstanding changes. As soon as I request a restart, the list becomes empty again. So this is exactly what I needed!

Showing results for 
Search instead for 
Did you mean: 

Recommended for You