Introducing SOC Insights for BloxOne Threat Defense: Boost your SOC efficiency with AI-driven insights to eliminate manual work and accelerate investigation and response times. Read the blog announcement here.

Community Blog

126418927-660x454.jpg

Getting Started with the Infoblox Web API

Infoblox now offers an interface to NIOS based on REST (REpresentational State Transfer). This API, which we're calling WAPI (or Web-based API), is also called a RESTful web API and is available starting with NIOS release 6.6. This API can be used to query your NIOS environment or to build tools that interact with NIOS to automate your organization's work processes.

 

Today we are releasing some tutorial code to help you get started using WAPI to interface with NIOS. These first samples are written in Perl and should help developers working with our PAPI interface come up to speed with the RESTful API. There are also sample programs available that show how to use the API in Java and Javascript. Over time, we will continue to add code samples and examples to show how to work with the API or explain best practices on common uses, and to expand our samples to other languages.

 

The RESTful API does not require client software and will work with your grid master without a need for any additional hardware. Because the API lives on the grid master, it will scale as your network grows and it will it will take advantage of the redundancy and high availability you build into your grid.

It enables clients to work with NIOS releases. The API is versioned, so you can build tools with confidence that future releases of NIOS won't cause your applications to break. Existing versions of the API will be supported into some future releases to give you time to plan any updates to your applications and decide when to take advantage of the new capabilities.

 

The RESTful API uses HTTP methods for operations and supports input and output in JSON and XML, and it uses HTTPS (HTTP over SSL/TLS) as the transport mechanism. The server certificate used for the RESTful API is the same certificate used by NIOS for the GUI and PAPI.

 

The introduction to the WAPI and the sample code is available on this site. If you have questions or suggestions about future topics to be covered in our tutorials, you can discuss them in the forums. We'd love to hear your ideas on future code examples you'd find useful, how you are using the API to solve problems, and how you'd like to see the API grow and improve over time.

Comments
Employee
‎01-31-2013 07:22 AM

Chuq,

This is great stuff. I was able to use the new REST API to create a host, search for it and then delete it using curl from my shell. Here is what I did:

 

Create a host:

 

curl -k -u admin:infoblox -H "Content-Type: application/json" -X POST https://10.65.16.12/wapi/v1.0/record:host -d '{ "ipv4addrs":[{"configure_for_dhcp": false,"ipv4addr": "10.10.10.12"}],"name": "newhost.bloxdemo.com","view": "default"}'

 

 

Search for the host:

 

 

curl -k -u admin:infoblox -X GET https://10.65.16.12/wapi/v1.0/record:host -d name~=newhost

 

The search returns data that contains the host:

 

[

    {

        "_ref": "record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5ibG94ZGVtby5uZXdob3N0:newhost.bloxdemo.com/default", 

        "ipv4addrs": [

            {

                "_ref": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQuY29tLmJsb3hkZW1vLm5ld2hvc3QuMTAuMTAuMTAuMTIu:10.10.10.12/newhost.bloxdemo.com/default", 

                "configure_for_dhcp": false, 

                "host": "newhost.bloxdemo.com", 

                "ipv4addr": "10.10.10.12"

            }

        ], 

        "name": "newhost.bloxdemo.com", 

        "view": "default"

    }

]

 

 

Delete the host:

 

 

curl -k -u admin:infoblox -X DELETE https://10.65.16.12/wapi/v1.0/record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5ibG94ZGVtby5uZXdob3N0

 

‎02-21-2013 10:27 AM

FYI -
If curl gives you heartburn that looks like this: 

curl: (35)error:14077458Smiley FrustratedSLroutinesSmiley FrustratedSL23_GET_SERVER_HELLO:reason(1112)


simply add a "-3" to the command... for example, to add an A record:


curl -k -3 -u admin:infoblox -H "Content-Type: application/json" -X POST https://gm.vm/wapi/v1.0/record:a -d '{"ipv4addr":"10.10.10.10","name":"wapirecord.lab"}'

Happy web scripting! ~Phil

Authority
‎04-10-2013 02:57 PM

This also worked great:

https://<userSmiley Tongueassword>@<host>/wapi/v1.0/record:host?name~=<hostname-match>

(used chrome)

Not that it is of much use on its own from a browser ;-)

Showing results for 
Search instead for 
Did you mean: