I have a customer that did not have access to run a Python Script so I came up with the idea of using Postman to do it. The list of values was in the form of a CSV file.
- Steps
- Create EA “Names”
- Install Postman
- Get EA _ref
- Convert CSV to JSON
- Put EA _ref
Create an EA in NIOS
Log into your NIOS box and create an EA with the name of “Names” type of List and add a value “Testvalue”
Install Postman
Go to https://www.getpostman.com download it for your OS and follow there install guide
Get EA “_ref” from Infoblox
We are going to use “Postman” to make an API call my Infoblox appliance to call an Extensible Attributes called “Names” which is a list.
Here are a few screenshots on how to configure “Postman” to get the EA “_ref”
Make sure SSL certificate verification is turned off in Postman settings or preferences.
- Here is the URL for the API call (substitute the IP address of your gridmaster) https://192.168.0.200/wapi/v2.9/extensibleattributedef?_return_fields=list_values
- Use “Basic Auth” then add username and password
-
- For “Headers” we need to add Key “Content-Type” value “application/json”
-
- For the Body select “raw” and make sure “JSON(application/json) and value {“name”:“Names”}
-
- Now we hit “Send” and get the results the data we are looking for is the “_ref” value “extensibleattributedef/b25lLmV4dGVuc2libGVfYXR0cmlidXRlc19kZWYkLk5hbWVz:Names” we will use this in our next “Postman” call
Convert CSV to JSON
- Here is what the CSV looks like:
- Found this great site to convert CSV to “Many” in my case I want to convert CSV-to-JSON – http://www.convertcsv.com/csv-to-json.htm
- Copy the content to Step 1 at convertcsv.com
- Click at the bottom convert to CSV to JSON
- We get a very useful format that we can use in “Postman”, only thing instead of “Site” we need it to state “value”, so let’s redo the converting process with a change in “Step 1” at convertcsv.com
- Change “Site” to “value” now we generate a new output
Update the EA using “_ref”
So now we are the “_ref” for the EA:Names and the data formatted into JSON we will make a PUT call using “Postman”
- We will create a new API call
- Notice we are using “PUT” and “Authorization” using “Basic Auth”, user your Username and Password for Infoblox(make sure it’s an ADMIN or it has an API access as well not just the GUI)
- The URL (paste in your IP address and your value for “_ref” that you got from the previous query) “https://192.168.0.200/wapi/v2.9/extensibleattributedef/b25lLmV4dGVuc2libGVfYXR0cmlidXRlc19kZWYkLk5hb…”
- Now we add the Headers
- “Content-Type” equals “application/json”
- Now for the Body we paste in the converted JSON output from www.convertcsv.com
- Notice that we are in the Body tab and make sure you select “JSON(application/json) and another thing to take note of my pasted data looks different from the original screenshot after the converted text.
-
{ "list_values": [ { "value": "JFK" }, { "value": "DEN" }, { "value": "SLC" }, { "value": "LAX" } ] }
- The reason for that is we are adding data to a “list” so we have to say here is the “list of values”(list_values)
- Now we hit SEND and it will create the List that we need in Infoblox – “Status” message of 200 OK!
- If we did everything correctly you will see something like above
- Now we login into Infoblox and we will see our List with the data we passed in via an API
Appendix:
Postman Collection have been added download under Attachments rename it to json- Thanks to Chad Willard
infoblox stuff.postman_collection.txt 5 KB