topic simple request to get a cookie in API & Integrationhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1221#M9
Request the Grid object. That's quick and the return is small.Tue, 22 Apr 2014 23:41:41 GMTDSmith2014-04-22T23:41:41ZThe definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1214#M2
<P>A common question we are asked is "Do you have some examples of specific&nbsp;REST calls", or "How can I get started with testing the WAPI?".</P>
<P>&nbsp;</P>
<P>The API docs are good if you need the techincal details, but this post&nbsp;hopes to address the overall fundamentals.</P>
<P>&nbsp;</P>
<P><STRONG>The basics</STRONG>:</P>
<UL>
<LI>use GET to get/search</LI>
<LI>use POST to add</LI>
<LI>use PUT to modify</LI>
<LI>use DELETE to remove</LI>
</UL>
<P>If you want to modify an object, you have to use a GET to read it first.</P>
<P>This will give you the <STRONG>_ref</STRONG>, which will be the URL you use to make the update.</P>
<P>&nbsp;</P>
<PRE>Get a host:
GET /wapi/v1.2/record:host?name~=test.com
will return:
{
"result": [
{"_ref": "record:host/ZG5zLmhvc3QkLjEyOC5jb20udGVzdC5nZXJpLnRlc3RfaG9zdA:test_host.test.com/default.GerW",
"name": "test_host.test.com",}
],
},</PRE>
<P>To modify a host, you then send a PUT to the <STRONG>_ref</STRONG> url:</P>
<P>&nbsp;</P>
<PRE>PUT /wapi/v2.3/record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm9yZy5naC5mb28:foo.gh.org/default
Content-Type: application/json
{"ipv4addrs": [
{
"ipv4addr": "1.1.1.2"
}
]}
</PRE>
<P><STRONG>Note</STRONG>: When making POST or PUT requests, it is easier to send the data as&nbsp;'application/json' in the body of the message, since it lets you send&nbsp;complex data structures in the payload</P>
<P>&nbsp;</P>
<P><STRONG>Note</STRONG>: There is no '_return_fields=ALL' option, so if you need are&nbsp;particular field returned, you will&nbsp;have to add it manually to your call&nbsp;with a '_return_fields+=myfield'</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P><STRONG>Now, to the examples</STRONG>:</P>
<PRE>Search for HOST by name:
GET /wapi/v1.2/record:host?name~=my.fqdn.org
Search for FixedAddress by MAC
GET /wapi/v1.2/fixedaddress?_return_fields%2B=mac&amp;mac=aa:bb:cc:11:22:33
Search for any objects with an IP address
GET /wapi/v1.2/ipv4address?status=USED&amp;ip_address=1.1.1.1
Add a HOST
POST /wapi/v1.2/record:host
Content-Type: application/json
{ "name":"wapi.test.org",
"ipv4addrs":[
{
"ipv4addr":"1.1.1.21"
}
]
}
Delete a host
( you need the _ref to the host first )
DELETE /wapi/v1.2/record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm9yZy5naC53YXBp
Update a host, or change the IP address
( you need the _ref to the host first )
PUT /record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm9yZy5naC53YXBp
Content-Type: application/json
{
"ipv4addrs":[
{ "ipv4addr":"1.1.1.31" }
]
}
Add or remove IP addresses from a HOST
( without altering the original list )
Use 'ipv4addrs+' or 'ipv4addrs-'
PUT /record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm9yZy5naC53YXBp
Content-Type: application/json
{
"ipv4addrs+":[
{ "ipv4addr":"2.2.2.22" }
{ "ipv4addr":"4.4.4.24" }
]
}
PUT /record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm9yZy5naC53YXBp
Content-Type: application/json
{
"ipv4addrs-":[
{ "ipv4addr":"3.3.3.33" }
]
}
Add a HOST with next_available IP address from a network
POST /wapi/v1.2/record:host
Content-Type: application/json
{ "name":"wapi.test.org",
"ipv4addrs":[
{
"ipv4addr":"func:nextavailableip:10.1.1.0/24"
}
]
}
'func:' syntax also supports these forms:
func:nextavailableip:network/ZG54dfgsrDFEFfsfsLzA:10.0.0.0/8/default
func:nextavailableip:10.0.0.0/8
func:nextavailableip:10.0.0.0/8,external
func:nextavailableip:10.0.0.3-10.0.0.10
OR you can use the longhand form:
POST /wapi/v1.2/record:host
Content-Type: application/json
{ "name":"wapi.test.org",
"ipv4addrs":[
ipv4addr" : {
"_function" : 'next_available_ip' ,
"_object_field" : 'value' ,
"_object" : '10.10.10.0/24' ,
"_parameters" : {
"num" : 1,
"exclude" : [ '45.0.1.1' , '45.0.1.2' ],
}
}
]
}
Add a HOST with next_available IP address from a network
using a complex search ( e.g Extensible Attributes ).
You need to pass the search criteria in the _object_parameters field
not also that '_object' changes from a reference to a type
POST /wapi/v1.2/record:host
Content-Type: application/json
{ "name":"wapi.test.org",
"ipv4addrs":[
ipv4addr" : {
"_function" : 'next_available_ip' ,
"_object_field" : 'value' ,
"_object" : 'network'
"_object_parameters" : {
"*Site" : "Santa Clara"
},
"_parameters" : {
"num" : 1,
"exclude" : [ '45.0.1.1' , '45.0.1.2' ],
}
}
]
}
Add a HOST with a fixed address
POST /wapi/v1.2/record:host
Content-Type: application/json
{ "name":"wapi.test.org",
"ipv4addrs":[
{
"ipv4addr":"1.1.1.21",
"mac":"aa:bb:cc:11:22:21"
}
]
}
Add a Fixed address
POST /wapi/v1.2/fixedaddress
Content-Type: application/json
{
"ipv4addr": "1.1.1.21",
"mac": "aa:bb:cc:11:22:21"
}
Add a Fixed address Reservtion
POST /wapi/v1.2/fixedaddress
Content-Type: application/json
{
"ipv4addr": "1.1.1.21",
"mac": "00:00:00:00:00:00"
}
Search for a subnet
GET /wapi/v1.2/network?network=1.1.1.0/24
Get Next Available address from a subnet
( you need the _ref to the subnet first )
POST /wapi/v1.2/network/ZG5zLm5ldHdvcmsuMC8yNC83?_function=next_available_ip
Content-Type: application/json
{"num": 1}
Get the next 5 IP addresses
( you need the _ref to the subnet first )
POST /wapi/v1.2/network/ZG5zLm5ldHdvcmsuMC8yNC83?_function=next_available_ip
Content-Type: application/json
{"num": 5}
Get all the addresses (and records) in a subnet
GET /wapi/v1.2/ipv4address?network=1.1.1.0/24
Get all the IP addresses in a given range
GET /wapi/v1.2/ipv4address?ip_address&gt;=1.1.1.1&amp;ip_address&lt;=1.1.1.10
Search for HOSTS by Extensible Attribute
( prepend '*' to the front of the EA name )
GET /wapi/v1.2/record:host?_return_fields%2B=extattrs&amp;*Floor=3rd
Add extensible Attributes to an object
PUT /wapi/v1.2/record:host/ZG5zLmhvc....
Content-Type: application/json
{
"extattrs": {
"Site": { "value": "East" }
}
}
Add a HOST with aliases
POST /wapi/v1.2/record:host
Content-Type: application/json
{ "name":"wapialiased.test.org",
"ipv4addrs":[ { "ipv4addr":"1.1.1.21"} ],
"aliases": [ "remote","pointer" ]
}
Get all the aliases on a host
GET /wapi/v1.2/record:host?_return_fields%2B=aliases&amp;name=wapialiased.test.org
Remove or modify aliases from a host
( send an enpty alias list, or a new list )
( you need the _ref to the host first )
PUT /wapi/v1.2/record:host/ZG5zLmhvc3l9kZWZhdWx0Lm9yZy5naC53YXBpYWxpYXNlZA
Content-Type: application/json
{
"aliases": [ ]
}
Add a CNAME
POST /wapi/v1.2/record:cname
Content-Type: application/json
{
"name":"cname.test.org",
"canonical" : "wapi.test.org"
}
DELETE a CNAME
( you need the _ref to the cname first )
DELETE /wapi/v1.2/record:cname/ZG5zLmJpbm...
Move a cname to point to a new canonical
( you need the _ref to the cname first )
PUT /wapi/v1.2/record:cname/ZG5zLmJpbmRfY
Content-Type: application/json
{
"canonical" : "wapi-new.test.org"
}
Add a network or a container
( NIOS will auto create the container if it needs to )
POST /wapi/v1.2/network
Content-Type: application/json
{
"network": "45.0.45.0/24"
}
Add a network and assign to a member
POST /wapi/v1.2/network
Content-Type: application/json
{
"network": "45.0.46.0/24",
"members": [
{
"_struct": "dhcpmember",
"ipv4addr" : "192.168.1.3"
}
]
}
Add a DHCP range
POST /wapi/v1.2/range
Content-Type: application/json
{
"start_addr": "45.0.46.20",
"end_addr": "45.0.46.101",
"server_association_type": "MEMBER" ,
"member":
{
"_struct": "dhcpmember",
"ipv4addr" : "192.168.1.3"
}
}
Add a DHCP reserved range
( If you don't assign a member, the range just gets created as 'reserved')
POST /wapi/v1.2/range
Content-Type: application/json
{
"start_addr": "45.0.46.20",
"end_addr": "45.0.46.101",
}
Add a zone association to a network
( 'is_default' is a BOOLEAN, so you don't quote the word 'true' )
PUT /wapi/v1.2/network/ZG5zLm5l...
Content-Type: application/json
{
"zone_associations": [
{
"fqdn": "test.org",
"is_default" : true
}
]
}
List the zone_associations on a network
GET /wapi/v1.2/network/ZG5zLm5l...?_return_fields%2B=zone_associations
Add a zone, of type forward
'forwarding_servers' are the grid members that will forward for that zone
POST /wapi/v1.2.1/zone_forward
{
"fqdn": "foo.com",
"forward_to": [
{"address": "1.1.1.1", "name": "ns.foo.com"},
{"address": "1.1.1.2", "name": "ns2.foo.com"}],
"forwarding_servers": [
{"name": "infoblox2.localdomain"},
{"name": "infoblox1.localdomain"}
]
}'
Get grid service status
GET /wapi/v1.4/grid
POST /wapi/v1.4/grid/b25lLmNsdXN0ZXIkMA:Infoblox?_function=requestrestartservicestatus
Content-Type: application/json
{"service_option": "All|DNS|DHCP"}
Restart services
GET /wapi/v1.4/grid
POST /wapi/v1.4/grid/b25lLmNsdXN0ZXIkMA:Infoblox?_function=restartservices
Content-Type: application/json
{
"member_order" : "SIMULTANEOUSLY",
"service_option": "ALL"
}
{"service_option": "All|DNS|DHCP"}
Export a database
POST /wapi/v1.4/fileop?_function=getgriddata
Content-Type: application/json
{"type": "BACKUP"}
GET /http_direct_file_io/...
Content-type: application/force-download
And remember to remove the stored file via the token
POST /wapi/v1.4/fileop?_function=downloadcomplete
Content-Type: application/json
{"token": "eJydULFuwyAQ3e9...="}
Export a CSV file
POST /wapi/v1.5/fileop?_function=csv_export
Content-Type: application/json
{"_object": "record:host"}
You will get back a URL for the download, and a token
for the download session. you can download the file directly
from the URL
GET /http_direct_file_io/...
Content-type: application/force-download
And remember to remove the stored file via the token
POST /wapi/v1.4/fileop?_function=downloadcomplete
Content-Type: application/json
{"token": "eJydULFuwyAQ3e9...="}
Export the results of a WAPI call
and save the data to disk
(Yes, you can cache results )
POST /wapi/v1.5/fileop?_function=read
Content-Type: application/json
{
"_encoding" : "JSON"
"_filename" : "allhosts.corp.org.json"
"_object" : "record:host"
"_return_fields" : "name,extattrs"
"zone" : "corp.org"
}
The file will be in a folder 'wapi_output' in the HTTP file distribution</PRE>
<P>&nbsp;</P>
<P>&nbsp;</P>Wed, 15 Mar 2017 19:09:20 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1214#M2GHorne2017-03-15T19:09:20ZThank you!https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1215#M3
<P>Great post, helped <EM>a lot</EM> more than the documentation!</P>Fri, 31 Jan 2014 09:33:28 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1215#M3AWahlqvist2014-01-31T09:33:28ZThanks!!!https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1216#M4
<P>Very helpfull !!&nbsp;<BR />
but it would be great if properly arrange REST commands are added...<BR />
<BR />
e.g :&nbsp;<BR />
For Associating Domain to a Subnet<BR />
curl -k -u admin:infoblox -H "Content-Type: application/json" -X PUT <A href="https://130.175.209.15/wapi/v1.2.1/network/ZG5zLm5ldHdvcmskMTMwLjE3MS4wLjAvMTYvMA" target="_blank">https://130.175.209.15/wapi/v1.2.1/network/ZG5zLm5ldHdvcmskMTMwLjE3MS4wLjAvMTYvMA</A> \-d '{ "zone_associations":[{ "fqdn":"aa.eds.com", "is_default":false, "view":"default" }]}'<BR />
<BR />
<BR />
&nbsp;</P>Mon, 10 Feb 2014 16:18:39 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1216#M4BTrivedi2014-02-10T16:18:39Zwhat if you don't want to usehttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1217#M5
<P>what if you don't want to use curl ?</P>
<P>what if you are using some other client to make the REST calls ?</P>
<P>what if you aren't using a linux shell ?</P>Wed, 12 Feb 2014 17:45:59 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1217#M5GHorne2014-02-12T17:45:59ZThere is something other thanhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1218#M6
<P>There is something other than Linux?</P>Thu, 20 Mar 2014 21:40:26 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1218#M6ARoberts2014-03-20T21:40:26ZGood insctructions. Could we get bit more?https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1219#M7
I have problem with adding allow_transfer. Below are curl which I am using to test. I always get a "Missing struct type in allow_transfer." error. Manual is not very helpful
curl -k -u admin:admin -H "Content-Type: application/json" -X POST <A href="https://1.1.1.1/wapi/v1.2/zone_auth" target="_blank">https://1.1.1.1/wapi/v1.2/zone_auth</A> -d '{ "fqdn":"testdomain.com","view": "default","soa_email":"hostmaster@dummy.com","comment":"comment","set_soa_serial_number":true,"soa_serial_number":1,"copy_xfer_to_notify":true,"use_allow_transfer":true,"allow_transfer":[ { "namedacl":"ACL_AUTH"} ]}'
curl -k -u admin:admin -H "Content-Type: application/json" -X POST <A href="https://1.1.1.1/wapi/v1.2/zone_auth" target="_blank">https://1.1.1.1/wapi/v1.2/zone_auth</A> -d '{ "fqdn":"testidomain.fi","view": "default","soa_email":"hostmaster@dummy.com","comment":"comment","set_soa_serial_number":true,"soa_serial_number":1,"copy_xfer_to_notify":true,"use_allow_transfer":true,"allow_transfer":[{"address":"2.2.2.2","address":"3.3.3.3"}]}'
Any tips how to make this work?Wed, 26 Mar 2014 14:39:03 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1219#M7EKuusisto2014-03-26T14:39:03Zexamples of using ibapauth cookie vs always sending credentialshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1220#M8
<P>My biggest question about this is whether there is some dead-simple / low overhead request that can be used as a throwaway on the first request to get the ibapauth cookie generated? &nbsp;I assume there is no way to get the cookie generated without making some sort of request. &nbsp;There isn't a small,&nbsp;plain file of some sort that could be retrieved like nios_version.txt, is there?</P>Tue, 22 Apr 2014 23:20:47 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1220#M8SBertilson2014-04-22T23:20:47Zsimple request to get a cookiehttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1221#M9
Request the Grid object. That's quick and the return is small.Tue, 22 Apr 2014 23:41:41 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1221#M9DSmith2014-04-22T23:41:41ZAdding a fixed addresshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1222#M10
<P>Hi,</P>
<P>can someone please give me an example for adding a fixed address with curl?</P>Tue, 13 May 2014 09:08:34 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1222#M10DFeindel2014-05-13T09:08:34Zdoes using ibapauth to maintain a "session" decrease overhead?https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1223#M11
<P>Have been tempted to test this myself just to get a solid empirical answer, but those who can see inside can probably answer based on how it was designed.</P>
<P>Is there real benefit in decreased overhead if one uses the ibapauth cookie to avoid re-authenticating in a series of requests?</P>
<P>I assume the benefit would be greater if the grid is configured to externally authenticate than if accounts are defined internally to the grid.&nbsp; Right?</P>Wed, 28 May 2014 21:15:13 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1223#M11SBertilson2014-05-28T21:15:13ZRange?https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1224#M12
<P>How about an example for the RANGE object?</P>Mon, 23 Jun 2014 16:57:58 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1224#M12JLeveillee2014-06-23T16:57:58Zyes, using the cookie saves ahttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1225#M13
<P>yes, using the cookie saves a lot of overhead.</P>
<P>the downside is that because it is an HTTPONLY cookie you can't remove it from the browser. so there is no clean logout.</P>
<P>this has been fixed in WAPI version 1.5 with the '/logout' uri</P>Mon, 23 Jun 2014 18:32:16 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1225#M13GHorne2014-06-23T18:32:16ZWAPI Documentation?https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1226#M14
I have a few questons:
- Where is the WAPI documentation? What are all the types that can be used?
- For returning a list in chunks of 50 records at a time, _max_results gives me the 50, but how do I do an offset? This might be a cursor question.
- Is there an efficient way to get all the record:host objects in a network? I can get all the used ipv4addrs
curl -k -u admin:infoblox -X GET https://infoblox/wapi/v1.4.1/ipv4addrs -d 'network=172.26.3.0/24&amp;status=USED&amp;types=HOST'
But all I can see to do at the moment is to retrieve the record/host from the objects data element and then call
foreach ref in the return list call
curl -k -u admin:infoblox -X GET https://infoblox/wapi/v1.4.1/<REF>
Why do I need it? Well the host record contains extattrs and a comment that I need as well.</REF>Mon, 04 Aug 2014 12:23:44 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1226#M14RMcKenzie2014-08-04T12:23:44ZAdding new IP to existing Host Objecthttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1227#M15
<P>Is there any way to add additional IP to a Host object knowing only the _ref but not knowing the list of existing IP addresses? The below example requires to get all v4 and v6 addresses first as this API call overwrites existing addresses.</P>
<P>Update a host, or change the IP address<BR />
( you need the _ref to the host first )</P>
<PRE>
PUT /record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm9yZy5naC53YXBp
Content-Type: application/json
{
"ipv4addrs":[
{ "ipv4addr":"1.1.1.31" }
]
}</PRE>Wed, 18 Feb 2015 11:40:49 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1227#M15PKsiazak2015-02-18T11:40:49ZUse ipv4addrs+ to add one or more IP addresses to host recordhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1228#M16
<P>If you have an existing host record and you want to add one or more new IP addresses for that host record, you can do that by using the field name 'ipv4addrs+' when you do the HTTP PUT to modify the host record. This does NOT require you to know what the existing IP addresses are for that host. This functionality is documented for WAPI 1.1 (NIOS 6.7) and later, but actually works in WAPI 1.0 (NIOS 6.6) as well.</P>
<P>Here's a working example in Python (with no error checking, obviously):</P>
<PRE>
import requests
import sys
import json
request_params = {'name': 'host1.example.com'}
r = requests.get('<A href="https://gm.example.com/wapi/v1.0/record:host'," target="_blank">https://gm.example.com/wapi/v1.0/record:host',</A>
params=request_params,
auth=('admin', 'infoblox'))
host_ref = r.json()[0]['_ref']
request_data = {'ipv4addrs+': [{'ipv4addr': '192.168.201.16'}]}
r = requests.put('<A href="https://gm.example.com/wapi/v1.0/'" target="_blank">https://gm.example.com/wapi/v1.0/'</A> + host_ref,
data=json.dumps(request_data),
auth=('admin', 'infoblox'))</PRE>
<P>Note that you can add multiple IP addresses by simply including&nbsp;more items in&nbsp;the list:</P>
<PRE>
request_data = {'ipv4addrs+': [{'ipv4addr': '192.168.201.17'},
{'ipv4addr': '192.168.201.18'}]}
r = requests.put('<A href="https://gm.example.com/wapi/v1.0/'" target="_blank">https://gm.example.com/wapi/v1.0/'</A> + host_ref,
data=json.dumps(request_data),
auth=('admin', 'infoblox'))</PRE>
<P>Finally, note that you can also use the field name 'ipv4addrs-' to remove one or more IP addresses for that host; for example, the following code would remove all the IP addresses added above:</P>
<PRE>
request_data = {'ipv4addrs-': [{'ipv4addr': '192.168.201.16'},
{'ipv4addr': '192.168.201.17'},
{'ipv4addr': '192.168.201.18'}]}
r = requests.put('<A href="https://gm.example.com/wapi/v1.0/'" target="_blank">https://gm.example.com/wapi/v1.0/'</A> + host_ref,
data=json.dumps(request_data),
auth=('admin', 'infoblox'))</PRE>Wed, 18 Feb 2015 15:54:29 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1228#M16FHecker2015-02-18T15:54:29ZAll,https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1229#M17
<P>All,</P>
<P>I've made this thread sticky/featured, so it should remain "a-top" the list. &nbsp;If you haven't read about the upcoming changes to the site, please take a look at this blog: &nbsp;<A href="https://community.infoblox.com/blogs/2015/04/01/it-may-be-april-1-no-joke-big-changes-coming-community&nbsp;" target="_blank">https://community.infoblox.com/blogs/2015/04/01/it-may-be-april-1-no-joke-big-changes-coming-community&nbsp;</A></P>
<P>As we continue to build out the plan for the updates, we want to hear from you. &nbsp;Please comment on the blog so we can continue to track requests. I'll keep the community updated on a weekly blog. &nbsp;"Plan the work, and work the plan..."</P>
<P>Best,</P>
<P>Eric</P>Tue, 07 Apr 2015 00:19:17 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1229#M17ems2015-04-07T00:19:17ZTop-Level Subnethttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1230#M18
I have a Network that has been further Subnetted which displays a folder over the Network from the GUI. I want to be able to directly Query that Object to return the Networks that have been subnetted from that Sub/Network..so on so forth..Is there a call to the API for that?Wed, 22 Apr 2015 18:10:39 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1230#M18SWomack2015-04-22T18:10:39ZListing all subnets within a given subnethttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1231#M19
<P>I think what you're asking for is as follows: You have a network container, i.e., a subnet that contains other subnets (and that shows up as a folder icon in the Infoblox IPAM view). You would like a list of all subnets that are contained within that network container. So, for example, if 10.0.0.0/8 is a network container, you would like a list of the subnets into which 10.0.0.0/8 has been divided (e.g., 10.1.0.0/16, 10.2.0.0/16, etc.). Note that it is possible that some of these subnets are actually network containers themselves (for example, 10.1.0.0/16 might be further divided into multiple /24 subnets), while some of the subnets are not further divided (for example, 10.2.0.0/16 might be a "leaf" network containing DHCP ranges, etc.).</P>
<P>In the context of the Web API there are network container&nbsp;objects that contain other networks or network&nbsp;containers, and network&nbsp;objects that do not. In order to find out how a given network container is subnetted using the Web API, you have to retrieve the child networks and network containers via two separate searches that reference the parent network container. For example, the following curl command will return all networks (but *not* network containers) within the network container 10.0.0.0/8 :</P>
<PRE>
curl --tlsv1 --insecure --user 'admin:infoblox' '<A href="https://gm.example.com/wapi/v1.0/network?network_container=10.0.0.0/8'" target="_blank">https://gm.example.com/wapi/v1.0/network?network_container=10.0.0.0/8'</A></PRE>
<P>while the command</P>
<PRE>
curl --tlsv1 --insecure --user 'admin:infoblox' '<A href="https://gm.example.com/wapi/v1.0/networkcontainer?network_container=10.0.0.0/8'" target="_blank">https://gm.example.com/wapi/v1.0/networkcontainer?network_container=10.0.0.0/8'</A></PRE>
<P>will return all network containers (but *not* networks) within 10.0.0.0/8.</P>Thu, 23 Apr 2015 14:04:00 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1231#M19FHecker2015-04-23T14:04:00ZCanonicalhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1232#M20
Thanks Frank..
How do I Get/Create/Delete Canonicals..(I know I can list all CNAMEs to get all the Canonicals..but how would one only get a List of these?)Tue, 28 Apr 2015 23:23:44 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1232#M20SWomack2015-04-28T23:23:44ZGetting a list of all canonical nameshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1233#M21
<P>By "get a list of these" do you mean getting a list of all canonical names pointed to by CNAME records? Canonical names are not stored as a separate database object in the NIOS database. Rather they are simply values stored in the "canonical" field of record:cname objects. So to extract a list of all canonical names you have to first retrieve the list of all record:cname objects and then iterate through that list, extracting the values of the "canonical" field.</P>
<P>Here's an example of how to do that in Python:</P>
<PRE>
# Import the required Python modules.
import requests
import json
import getpass
import sys
# Set parameters to access the NIOS WAPI.
url = '<A href="https://gm.example.com/wapi/v1.0/'" target="_blank">https://gm.example.com/wapi/v1.0/'</A>
id = 'api-test' # Userid with WAPI access
valid_cert = True # False if GM uses self-signed certificate
# Prompt for the API user password.
pw = getpass.getpass('Password for user ' + id + ': ')
# Retrieve all CNAME records (up to a max of 5000) in the default DNS view.
dns_view = 'default'
max_results = -5000
req_params = {'view': dns_view,
'_max_results': str(max_results)}
r = requests.get(url + 'record:cname',
params=req_params,
auth=(id, pw),
verify=valid_cert)
if r.status_code != requests.codes.ok:
print r.text
exit_msg = 'Error {} finding CNAME records: {}'
sys.exit(exit_msg.format(r.status_code, r.reason))
results = r.json()
# For each CNAME record keep track of the canonical name pointed
# to by that record, by adding the canonical name to a Python set.
canonicals = set()
for result in results:
canonicals.add(result['canonical'])
# Sort the resulting set of canonical names and print them.
for canonical in sorted(canonicals):
print canonical
</PRE>
<P>Recall that a canonical name can be any valid domain name; it does not necessarily have to correspond to a DNS record in your NIOS database. So there is no separate operation to create (or delete) a canonical name; you simply use the canonical name as the value of the "canonical" field when creating a record:cname object.</P>Wed, 29 Apr 2015 14:16:00 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1233#M21FHecker2015-04-29T14:16:00ZChange a fixed MAC addresshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1234#M22
<P>Hi,</P>
<P>it is possible to change a fixed MAC address?</P>
<P>Does anyone know how?</P>Thu, 30 Apr 2015 12:56:53 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1234#M22MBermejoLopez2015-04-30T12:56:53ZWhere's the beef?https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1235#M23
<P>Hey all,</P>
<P>I am for a sample for the equlivant for</P>
<PRE>
Infoblox?_function=restartservices</PRE>
<P>in 1.7.1</P>
<P>When I try:</P>
<P>https://server/wapi/v1.7.1/Infoblox?_function=restartservices</P>
<P>POST Array<BR />
(<BR />
&nbsp;&nbsp;&nbsp; [member_order] =&gt; SEQUENTIALLY<BR />
&nbsp;&nbsp;&nbsp; [restart_option] =&gt; RESTART_IF_NEEDED<BR />
&nbsp;&nbsp;&nbsp; [service_option] =&gt; DNS</P>
<P>)</P>
<P>It returns:</P>
<P>{<BR />
&nbsp; "Error": "AdmConProtoError: Unknown object type (Infoblox)",<BR />
&nbsp; "code": "Client.Ibap.Proto",<BR />
&nbsp; "text": "Unknown object type (Infoblox)"<BR />
}</P>Tue, 02 Jun 2015 19:58:18 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1235#M23PDeschamps2015-06-02T19:58:18ZHow to restart services with WAPIhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1236#M24
<P>I was able to use the Web API (WAPI version 2.1) to successfully restart services. Based on my testing I believe the key points are as follows:</P>
<OL>
<LI>You need to do a POST request.</LI>
<LI>The URL must reference the object reference for the grid (as obtained from a previous GET request).</LI>
<LI>The function name (i.e., "restartservices") and its arguments (e.g., "member_order") must be passed as parameters as part of the URL.</LI>
</OL>
<P>The following example curl command will return the object reference for the grid:</P>
<PRE>
curl --tlsv1 --insecure --user admin:xxxxxx' '<A href="https://gm.example.com/wapi/v2.1/grid" target="_blank">https://gm.example.com/wapi/v2.1/grid</A></PRE>
<P>Assuming that the object reference is "grid/b25lLmNsdXN0ZXIkMA:example-grid", the following example curl command will restart services for DNS:</P>
<PRE>
curl --tlsv1 --insecure --user admin:xxxxxx' -X POST '<A href="https://gm.example.com/wapi/v2.1/grid/b25lLmNsdXN0ZXIkMA:example-grid?_function=restartservices&amp;member_order=SEQUENTIALLY&amp;restart_option=RESTART_IF_NEEDED&amp;sequential_delay=10&amp;service_option=DNS'" target="_blank">https://gm.example.com/wapi/v2.1/grid/b25lLmNsdXN0ZXIkMA:example-grid?_function=restartservices&amp;member_order=SEQUENTIALLY&amp;restart_option=RESTART_IF_NEEDED&amp;sequential_delay=10&amp;service_option=DNS'</A></PRE>Tue, 02 Jun 2015 20:54:18 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1236#M24FHecker2015-06-02T20:54:18ZHow to remove a reserved IPhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1237#M25
Thanks so much for all the posts above
I have 2 questions
1) Release reserved IP addresses
2) Problem with one POST request
1) I used below POST messages to reserve IP
{ "name":"host1.test.com",
"ipv4addrs":[
{
"ipv4addr":"func:nextavailableip:10.0.103.0/24"
}
]
}
or { "ipv4addr":"func:nextavailableip:10.0.42.0/24","mac": "00:00:00:00:00:00"}
or for DHCP reservation <A href="https://10.11.128.24/wapi/v2.0/range?start_addr=xx.xx.xx.xx&amp;end_addr=yy.yy.yy.yy" target="_blank">https://10.11.128.24/wapi/v2.0/range?start_addr=xx.xx.xx.xx&amp;end_addr=yy.yy.yy.yy</A>
Now I wanted to release the reserved IP. Also
2)I am facing issue with with POST message below with error as : EXPECTED array input for ipv4addrs etc
{
"name":"new.test.com" ,
"ipv4addrs": [
{
"ipv4addr":"func:nextavailableip:10.0.103.0/24",
"_function": "next_available_ip",
"_object_field": "value",
"_object": "10.10.10.0/24",
"_parameters": {
"num": 1,
"exclude": ["45.0.1.1", "45.0.1.2"]
}
}
]}
Hoping to listen back. ThanksMon, 22 Jun 2015 17:22:00 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1237#M25asaran2015-06-22T17:22:00ZRemoving a host recordhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1238#M26
<P>1. In this case you are using a host record (record:host object) to reserve an IP address, so you need to remove the host record in order to free up the IP address. This is a two-step process: First you need to get the object reference for the host record, using a GET request against a URL like</P>
<PRE>
<A href="https://gm.example.com/wapi/v2.1/record:host?name=host1.test.com" target="_blank">https://gm.example.com/wapi/v2.1/record:host?name=host1.test.com</A></PRE>
<P>For example, a curl command like the following will do this (assuming that you have only a single DNS view or that the name "host1.test.com" is unique across views):</P>
<PRE>
curl --tlsv1 --insecure -user 'admin:infoblox' '<A href="https://gm.example.com/wapi/v2.1/record:host?name=host1.test.com'" target="_blank">https://gm.example.com/wapi/v2.1/record:host?name=host1.test.com'</A></PRE>
<P>The result of this WAPI operation will include a <CODE>_ref</CODE> field with an object reference like the following:</P>
<PRE>
record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5leGFtcGxlLnJlc2VydmVk:host1.test.com/default</PRE>
<P>You then have to send a DELETE request referencing this object reference, for example as follows:</P>
<PRE>
curl --tlsv1 --insecure --user 'admin:infoblox' -X DELETE '<A href="https://gm.example.com/wapi/v2.1/record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5leGFtcGxlLnJlc2VydmVk:host1.test.com/default'" target="_blank">https://gm.example.com/wapi/v2.1/record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5leGFtcGxlLnJlc2VydmVk:host1.test.com/default'</A></PRE>
<P>I'll respond to your second question a little later once I have a chance to look at it more closely.</P>Tue, 23 Jun 2015 15:47:13 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1238#M26FHecker2015-06-23T15:47:13ZWAPI 1.7.1 Where's the beef?https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1239#M27
<P>Can someone point me to the API documentation for 1.7.1 I can not find it anywhere..<BR />
<BR />
OR... alternatively can someone update The definitive rest examples to include 1.7.1?&nbsp;</P>
<P>OR.. I am looking to search for a record by it's mac address.</P>
<P><A href="https://cas-hq.rim.net/owa/redir.aspx?C=AFTXRYotr0CCRlfZ0V-5ditW3Auni9IIAfSSF6jajK8irlNQh2Y0tPLwVh2ICYmSoS1fD_YEgQw.&amp;URL=https%3a%2f%2fibx01ykf.rim.net%2fwapi%2fv1.7.1%2fsearch%3fobjtype%3dAll%26search_string%3a%3d00%3a01%3a04%3aFF%3aA3%3a01" target="_blank">https://HOST/wapi/v1.7.1/search?objtype=All&amp;search_string:=00:01:04:FF:A3:01</A><BR />
<A href="https://cas-hq.rim.net/owa/redir.aspx?C=AFTXRYotr0CCRlfZ0V-5ditW3Auni9IIAfSSF6jajK8irlNQh2Y0tPLwVh2ICYmSoS1fD_YEgQw.&amp;URL=https%3a%2f%2fibx01ykf.rim.net%2fwapi%2fv1.7.1%2fsearch%3fobjtype%3dAllNetwork%26search_string%3a%3d00%3a01%3a04%3aFF%3aA3%3a01" target="_blank">https://HOST/wapi/v1.7.1/search?objtype=AllNetwork&amp;search_string:=00:01:04:FF:A3:01</A><BR />
<A href="https://cas-hq.rim.net/owa/redir.aspx?C=AFTXRYotr0CCRlfZ0V-5ditW3Auni9IIAfSSF6jajK8irlNQh2Y0tPLwVh2ICYmSoS1fD_YEgQw.&amp;URL=https%3a%2f%2fibx01ykf.rim.net%2fwapi%2fv1.7.1%2fsearch%3fobjtype%3drecord%3ahost_ipv4addr%26search_string%3a%3d00%3a01%3a04%3aFF%3aA3%3a01" target="_blank">https://HOST/wapi/v1.7.1/search?objtype=record:host_ipv4addr&amp;search_string:=00:01:04:FF:A3:01</A><BR />
<BR />
None of these work.<BR />
<BR />
Thanks</P>
<P>Paul</P>
<P>&nbsp;</P>
<P>&nbsp;</P>Mon, 06 Jul 2015 18:49:33 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1239#M27PDeschamps2015-07-06T18:49:33Z1.7.1 documentation, and using the search objecthttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1240#M28
<P>"Can someone point me to the API documentation for 1.7.1" You can find documentation for your release of NIOS under the help section of the UI. Click on the blue tab in the upper right that has a question mark (?) in a circle, and then in the resulting navigation bar click on the plus sign (+) for "Documentation". It should contain links to HTML versions of four manuals, including the WAPI manual.</P>
<P>"I am looking to search for a record by it's mac address." I was able to do this using the following Curl command on my NIOS 7.1 (WAPI 2.1) system:</P>
<PRE>
curl --tlsv1 --insecure --user 'admin:infoblox' '<A href="https://gm.example.com/wapi/v1.7.1/search?search_string:=00:80:77:7d:e1:cb'" target="_blank">https://gm.example.com/wapi/v1.7.1/search?search_string:=00:80:77:7d:e1:cb'</A></PRE>
<P>(In this case the query returned objects relating to a DHCP fixed address I had defined.)</P>Mon, 06 Jul 2015 21:42:31 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1240#M28FHecker2015-07-06T21:42:31ZCorrected example for adding a host using next_available_iphttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1241#M29
<P>The following shows how to add a host record using the next_available_ip function in current (7.x) versions of NIOS; it corrects one of the examples given in the original "Definitive List of REST Examples" above:</P>
<PRE>
curl --tlsv1 --insecure --user 'admin:infoblox' -H "Content-Type: application/json" -X POST <A href="https://gm.example.com/wapi/v2.0/record:host" target="_blank">https://gm.example.com/wapi/v2.0/record:host</A> -d '{"name": "test.example.com", "ipv4addrs": [{"ipv4addr": {"_object_function": "next_available_ip", "_object": "network", "_object_parameters": {"network": "10.0.0.0/24"}, "_result_field": "ips", "_parameters": {"num": 1, "exclude": ["10.0.0.4"]}}}]}'
</PRE>
<P>A more readable version of the POST body is as follows:</P>
<PRE>
{
"name": "test.example.com",
"ipv4addrs": [
{
"ipv4addr": {
"_object_function": "next_available_ip",
"_object": "network",
"_object_parameters": {"network": "10.0.0.0/24"},
"_result_field": "ips",
"_parameters": {
"num": 1,
"exclude": ["10.0.0.4"]
}
}
}
]
}
</PRE>Mon, 24 Aug 2015 14:26:00 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1241#M29FHecker2015-08-24T14:26:00ZAdd Permissionshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1242#M30
When creating a Container/Subnet what params do I use on the Object to Set Permissions on the Container/Network?Mon, 31 Aug 2015 16:03:13 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1242#M30SWomack2015-08-31T16:03:13Zinfoblox WAPI and .Net integrationhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1243#M31
<P>Hi All,</P>
<P>&nbsp;</P>
<P>I have to use the Infoblox WAPI with .Net code in a restful approach.Do we have some examples in .Net ?</P>Tue, 01 Sep 2015 18:10:15 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1243#M31gsingh2015-09-01T18:10:15ZInfoblox WAPI for performing following tasks !!https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1244#M32
<P>Hi All,</P>
<P>I have to do the following task using the WAPI , any assistance will be great !</P>
<P>1&gt;Create a DNS entries&nbsp;</P>
<P>2&gt;Remove DNS entries</P>
<P>3&gt;Assign DNS name to IP&nbsp;</P>
<P>4&gt;Remove Server from DNS</P>
<P>&nbsp;</P>
<P>Do we have WAPI's function for these ??</P>
<P>&nbsp;</P>
<P>&nbsp;</P>Tue, 01 Sep 2015 18:14:55 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/1244#M32gsingh2015-09-01T18:14:55ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4125#M293
<P>I'm using python with the WAPI, and cannot find a means of importing an ISC dhcpd.leases fileas part of a migration.&nbsp; It apears that the method import_data is not supported in the InfobloxAPI.py file.&nbsp; Is there another file I need to import?&nbsp; My call looks as follows:</P><PRE>def apiImportLeases(path):
i = InfobloxAPI(type='test',verbose=True,object='session',method='import_data')
data = {'type': 'leases','format': 'ISC', 'path': path,'lease_precedence': 'newest'}
i.data = data
i.username = un
i.password = pw
r = i.run()
return r</PRE><P>The response I get is:</P><PRE>Traceback (most recent call last):
File "&lt;pyshell#6&gt;", line 1, in &lt;module&gt;
apiImportLeases('/Users/Defitz/Downloads/dhcpd/dhcpd.leases_wss-1')
File "&lt;pyshell#4&gt;", line 2, in apiImportLeases
i = InfobloxAPI(type='test',verbose=True,object='session',method='import_data')
File "/Users/Defitz/Documents/InfobloxAPI.py", line 55, in __init__
raise Exception(self.method + " is not a valid method")
Exception: IMPORT_DATA is not a valid method</PRE>Wed, 07 Oct 2015 14:13:27 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4125#M293fitzie2015-10-07T14:13:27ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4783#M351
<P>quick question here about doing a search on an array field.&nbsp; In particular I'd like to search for ipv4address objects with a specific name in the names field.&nbsp; The wapi documentation says that this field is searchable and is of type string array.&nbsp; How does one go about searching a string array from the rest commands.&nbsp; For instance, to search by ip_address this works:</P><P>&nbsp;</P><P>"<A href="https://gm.example.com/wapi/v2.2/ipv4address?ip_address=10.10.10.10&quot;" target="_blank">https://gm.example.com/wapi/v2.2/ipv4address?ip_address=10.10.10.10"</A></P><P>&nbsp;</P><P>but this does not:</P><P>&nbsp;</P><P>"<A href="https://gm.example.com/wapi/v2.2/ipv4address?names=servername.example.com&quot;" target="_blank">https://gm.example.com/wapi/v2.2/ipv4address?names=servername.example.com"</A></P>Wed, 25 Nov 2015 13:34:40 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4783#M351jmmurrah2015-11-25T13:34:40ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4784#M352
<P>The ipv4address object requires searching on an ip address. &nbsp;If you include an ip address you can also search on name(s).</P>
<P>&nbsp;</P>
<P>E.g.,</P>
<P>&nbsp;</P>
<P><SPAN>"</SPAN><A href="https://gm.example.com/wapi/v2.2/ipv4address?names=servername.example.com&quot;" target="_blank" rel="nofollow">https://gm.example.com/wapi/v2.2/ipv4address?ip_address=10.10.10.10&amp;names<WBR />=servername.example.com"</A></P>
<P>&nbsp;</P>
<P>will work, but not&nbsp;</P>
<P>&nbsp;</P>
<P><SPAN>"</SPAN><A href="https://gm.example.com/wapi/v2.2/ipv4address?names=servername.example.com&quot;" target="_blank" rel="nofollow">https://gm.example.com/wapi/v2.2/ipv4address?names<WBR />=servername.example.com"</A></P>
<P>&nbsp;</P>
<P>To search on a name, try using the allrecords object instead.</P>
<P>&nbsp;</P>
<P>E.g.&nbsp;</P>
<P>&nbsp;</P>
<P>"<A href="https://gm.example.com/wapi/v2.2/allrecords?zone=example.com&amp;name=servername&amp;_return_fields%2b=address&quot;" target="_blank">https://gm.example.com/wapi/v2.2/allrecords?zone=example.com&amp;name=servername&amp;_return_fields%2b=address"</A></P>
<P>&nbsp;</P>
<P>You can also use the new object body request we added in WAPI 2.1/NIOS 7.1 to search for names across multiple objects at once. &nbsp;</P>
<P>&nbsp;</P>
<P>E.g.</P>
<P>&nbsp;</P>
<P>curl -k1 -u admin -H "Content-Type: application/json" -X POST <A href="https://gm.example.com/wapi/v2.2/request" target="_blank">https://gm.example.com/wapi/v2.2/request</A> -d '</P>
<P>[</P>
<P>&nbsp;&nbsp; {</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "method": "GET",</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "object": "record:host",</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "data": {"name":"servername.example.com"},</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "args": {"_return_fields":"name,dns_name,aliases,dns_aliases,ipv4addrs,configure_for_dns"}</P>
<P>},</P>
<P>&nbsp;&nbsp; {</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "method": "GET",</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "object": "record:a",</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "data": {"name":"<SPAN>servername.example.com</SPAN>"},</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "args": {}</P>
<P>},</P>
<P>{</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "method": "GET",</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "object": "record:cname",</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "data": {"name":"<SPAN>servername.example.com</SPAN>"},</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "args": {}</P>
<P>}</P>
<P>]'</P>Wed, 25 Nov 2015 18:51:37 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4784#M352JVoss2015-11-25T18:51:37ZCreate Extensible Attributes via an API?https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4958#M390
<P>Hello All,&nbsp;</P><P>&nbsp;</P><P>This list is awsesome and it has been so helpful in our automation.</P><P>&nbsp;</P><P>I am at a point where we are trying to use the&nbsp;<SPAN class="s1">extattrs to track addtional meta data. I am able to populate the various&nbsp;</SPAN><SPAN class="s1">extattrs just fine in a POST to /record:host, but the attributes MUST already exist.</SPAN></P><P>&nbsp;</P><P><SPAN class="s1">Is there an API that can be used to create additional attributes? Since the&nbsp;<SPAN>extattrs could be considered a "requirement" for our services automation, we would like to automatically create them if they do not already exist.</SPAN></SPAN></P>Tue, 15 Dec 2015 22:07:43 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4958#M390n02358542015-12-15T22:07:43ZRe: Create Extensible Attributes via an API?https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4961#M392
<P>Glad to hear that the examples have been helpful. &nbsp;</P>
<P>&nbsp;</P>
<P>If you have ideas or suggestions for other examples you'd like to see, please post them to the forum so we can keep adding to them.</P>
<P>&nbsp;</P>
<P>In NIOS 7.2/WAPI 2.2 we added support for creating/modifying extensible attribute definitions via WAPI.</P>
<P>&nbsp;</P>
<P>Example:</P>
<P>&nbsp;</P>
<P>curl -k1 -u ibuser -X POST 'https://[gridmaster]/wapi/v2.2/extensibleattributedef' -H "Content-Type:application/json" -d '{"name":"TestEA","type":"STRING"}'</P>
<P>&nbsp;</P>Wed, 16 Dec 2015 01:47:55 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4961#M392JVoss2015-12-16T01:47:55Z[do delete]https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4971#M394
<P>sorry, wrong topic. please delete entry.</P>Mon, 21 Dec 2015 10:07:31 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/4971#M394denpiepe2015-12-21T10:07:31ZRe: The definitive list of REST examples: Returning all A records from the external viewhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5112#M406
<P>Not sure if this is the correct place to post this however.</P>
<P>&nbsp;</P>
<P>Returning all A records from the external view.</P>
<P>&nbsp;</P>
<P>I have been seconded to a customer’s where the environment is tightly controlled and one of the tasks I have been asked to look at while here is to collect a list of all external DNS records from all their external facing DNS zones of which they have 10,000s.</P>
<P>&nbsp;</P>
<P>Access to their Grid is read only and I am working from a heavily locked down laptop. Anyway I have been able to load Firefox and the Restclient Add-on onto the machine I am working on.</P>
<P>&nbsp;</P>
<P>I have managed to return the following but when increasing the number of results returned get an error regarding the result set being too large.</P>
<P>&nbsp;</P>
<P><A href="https://HOST/wapi/v1.4.2/record:a?_return_type=xml-pretty&amp;view=external&amp;_max_results=20000" target="_blank">https://HOST/wapi/v1.4.2/record:a?_return_type=xml-pretty&amp;view=external&amp;_max_results=20000</A></P>
<P>&nbsp;</P>
<P>I was hoping to filter the results by ipv4addr and the first two octets of the addresses or perhaps using a not to exclude some of the large number of defensive domains that all refer to the same IP Address so have tried including ipv4addr~=208.67 (and several variations on this) and also ipv4addr!=208.67.220.220</P>
<P>&nbsp;</P>
<P>Any suggestion would be appreciated.</P>Fri, 08 Jan 2016 10:40:27 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5112#M406DEdwards2016-01-08T10:40:27ZRe: The definitive list of REST examples: Returning all A records from the external viewhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5131#M407
<P>Do a zone transfer. much faster and easier.</P>Fri, 08 Jan 2016 22:17:40 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5131#M407GHorne2016-01-08T22:17:40ZRe: The definitive list of REST examples: Returning all A records from the external viewhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5140#M410
<P>Hi,</P>
<P>&nbsp;</P>
<P>Thanks for the suggestion.&nbsp;We did considered doing a zone transfer of the main&nbsp;reverse zone in which all the PTRs for the public addresses should sit. However the configuration on the Grid has been populated over a number of years by different admins and there is no guarentee that PTRs have been created for all&nbsp;A and Host Records. Which&nbsp;is why I&nbsp;am looking at using the WAPi to &nbsp;retrieve the Information.</P>
<P>&nbsp;</P>
<P>Regards</P>
<P>&nbsp;</P>
<P>Dan</P>Mon, 11 Jan 2016 09:03:26 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5140#M410DEdwards2016-01-11T09:03:26ZRe: The definitive list of REST examples: Returning all A records from the external viewhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5151#M411
<P>Found was able to retrieve the information required using <A href="https://10.31.2.20/wapi/v1.4.2/record:a?_return_type=xml-pretty&amp;view=external&amp;_max_results=20000" target="_blank">https://10.31.2.20/wapi/v1.4.2/record:a?_return_type=xml-pretty&amp;view=external&amp;_max_results=20000</A> and the FF restclient. It kept generating a script error in FF but if you ended the script the data required was returned.</P>
<P>&nbsp;</P>
<P>The repeated for host records.</P>
<P>&nbsp;</P>
<P>Regards</P>
<P>&nbsp;</P>
<P>Dan</P>
<HR />Tue, 12 Jan 2016 11:57:23 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5151#M411DEdwards2016-01-12T11:57:23ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5178#M413
<P>This does help a lot.</P><P>&nbsp;</P><P>Is there a common method for returning values to a default setting?</P><P>&nbsp;</P><P>I have a zone that has overridden the GM values for the allow_transfer ACL. I would like to return this setting to the default value that inherits the GM setting.</P><P>&nbsp;</P><P>Thanks</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>Wed, 13 Jan 2016 21:22:34 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5178#M413ERadde2016-01-13T21:22:34ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5199#M416
<P>I answered my own question :&nbsp;the "use_" structure...</P><P>&nbsp;</P><P>example:</P><P>&nbsp;</P><P>curl -k1 -u admin<img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://cixhp49439.i.lithium.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" />asswd -H "Content-Type: application/json" -X PUT https://gridmaster/wapi/v2.2/zone_auth/klkl5zLnpvbmUkLl9kerTTr55NvbS50cmFuc3F1ZXN0:zonename.com/default -d '{"use_allow_transfer":false}'</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>Thu, 14 Jan 2016 20:25:43 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5199#M416ERadde2016-01-14T20:25:43ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5477#M434
<P>Going to add some examples i found hard to come by when&nbsp;trying to script additons to host or fixedaddress using variables, you need to use a double set of "" <img id="smileysad" class="emoticon emoticon-smileysad" src="https://cixhp49439.i.lithium.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /></P><P>Using Powershell for this.&nbsp;</P><P>&nbsp;</P><P>When using :</P><P>wapi/v2.2/<STRONG>record:host</STRONG></P><P>Your Json query should resemble:</P><P>"{""ipv4addrs"":[{""ipv4addr"":""$<SPAN>the_ip_you_want_to_use</SPAN>""}],""name"":""$your_server"",""configure_for_dns"":false}"</P><P>&nbsp;</P><P>When Using:</P><P>wapi/v2.2/<STRONG>fixedaddress</STRONG></P><P>&nbsp;</P><P>Your JSON query should resemble:</P><P>"{""ipv4addr"":""$the_ip_you_want_to_use"",""mac"":""00:00:00:00:00:00"",""name"":""$your_server""}"</P><P>Or</P><P>"{""ipv4addr"":""func:nextavailableip:10.10.10.0/24"",""mac"":""00:00:00:00:00:00"",""name"":""$your_server""}"</P>Wed, 10 Feb 2016 14:14:21 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/5477#M434Showboat2016-02-10T14:14:21ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6049#M539
<P>Hoping someone can help - anyway I can use the API to retrieve the available OR used IP space in a DHCP range? &nbsp;Either value works.</P>Thu, 07 Apr 2016 19:29:12 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6049#M539mleja22016-04-07T19:29:12ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6261#M588
<P>Is it possible to reclaim an IP with rest? &nbsp;If so, &nbsp;can I see an example?</P>Tue, 26 Apr 2016 19:58:26 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6261#M588dtruckenmiller2016-04-26T19:58:26ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6510#M613
<P>Hi, thanks very much for the overview.</P><P>&nbsp;</P><P>I was wondering if there is a way to retrieve all the extensible attributes from InfoBlox?</P><P>&nbsp;</P><P>We've created a few extensible attributes as a list that contain our network sites and countries. I would like to be able to retrieve (and possibly even edit) all configured list values through the API. Looking at the API documentation there doesn't seem to be a REST&nbsp;object for this so would require us to retrieve all objects and extract the data from there.</P><P>&nbsp;</P><P>Regards,</P><P>Matt</P>Wed, 18 May 2016 12:39:35 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6510#M613mmortimer2016-05-18T12:39:35ZRe: infoblox WAPI and .Net integrationhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6537#M614
<P>This is an extremely popular topic and thread so we're highlighting it throughout the site. &nbsp;Here is an additional thread with further info. &nbsp;We'll consider merging them, but the topics are slightly different.</P>
<P>&nbsp;</P>
<P><A href="https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/td-p/1214/page/2" target="_blank">https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/td-p/1214/page/2</A></P>
<P>&nbsp;</P>
<P>#WeGotYourBack</P>
<P>&nbsp;</P>
<P>Eric</P>Fri, 20 May 2016 13:03:26 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6537#M614EricS2016-05-20T13:03:26ZRe: infoblox WAPI and .Net integrationhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6538#M615
<P>This is an extremely popular topic and thread so we're highlighting it throughout the site. &nbsp;Here is an additional thread with further info. &nbsp;We'll consider merging them, but the topics are slightly different.</P>
<P>&nbsp;</P>
<P><A href="https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/td-p/1214/page/2" target="_blank">https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/td-p/1214/page/2</A></P>
<P>&nbsp;</P>
<P>#WeGotYourBack</P>
<P>&nbsp;</P>
<P>Eric</P>Fri, 20 May 2016 13:04:54 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6538#M615EricS2016-05-20T13:04:54ZRe: Removing a host recordhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6885#M666
<P>Hi, I"m new to infoblox. Our company just uses it for reserving IP addresses. We create IPv4 reservations that is just used for tracking. It is not linked to DNS so there is no mac address in the reservations that we create. In the rest call, is the mac mandatory? How would I use the API to remove the reservation?</P>Thu, 23 Jun 2016 14:53:55 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6885#M666jg1000c2016-06-23T14:53:55ZRe: Use ipv4addrs+ to add one or more IP addresses to host recordhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6894#M668
<P>Is this the same as removing a ipv4 reservation or is that a different object?</P><P>&nbsp;</P><P>Finally, note that you can also use the field name 'ipv4addrs-' to remove one or more IP addresses for that host; for example, the following code would remove all the IP addresses added above:</P><PRE>request_data = {'ipv4addrs-': [{'ipv4addr': '192.168.201.16'},
{'ipv4addr': '192.168.201.17'},
{'ipv4addr': '192.168.201.18'}]}
r = requests.put('<A href="https://gm.example.com/wapi/v1.0/'" target="_blank" rel="nofollow">https://gm.example.com/wapi/v1.0/'</A> + host_ref,
data=json.dumps(request_data),
auth=('admin', 'infoblox'))</PRE><P>&nbsp;</P>Thu, 23 Jun 2016 20:36:37 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/6894#M668jg1000c2016-06-23T20:36:37ZRe: infoblox WAPI and .Net integrationhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/7335#M725
<P>I haven't seen any .NET specific examples but there may be some on Github posted by other customers. &nbsp;There are a few repositories that provide some examples using PowerShell that may help lead you down the right path as well. &nbsp;There's even a post (by me) regarding one of the PowerShell repositories here.</P>
<P>&nbsp;</P>
<P><A href="https://community.infoblox.com/t5/API-Integration/Powershell-Infoblox-ps1/m-p/1150#M197" target="_blank">https://community.infoblox.com/t5/API-Integration/Powershell-Infoblox-ps1/m-p/1150#M197</A></P>
<P>&nbsp;</P>Tue, 09 Aug 2016 18:28:57 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/7335#M725DSmith2016-08-09T18:28:57ZRe: Removing a host recordhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/8125#M849
<P>For those of you using PowerShell, here's how to "reclaim" an IP address regardless of what type of record is assigned to it. &nbsp;I hope this helps someone.</P><P>&nbsp;</P><PRE>$ip = "10.10.5.100"
$Credential = Get-Credential
$InfobloxURI = "https://infobloxserver/wapi/v1.3/ipv4address?ip_address=$ip"
$ips = Invoke-RestMethod -Method GET $InfobloxURI -Credential $Credential
$objects = $ips.objects
foreach ($object in $objects)
{
$InfobloxURI = "https://infobloxserver/wapi/v1.3/$object"
Invoke-RestMethod -Method DELETE $InfobloxURI -Credential $Credential
}</PRE><P>&nbsp;</P><P>Don't forget to replace "infobloxserver" in the URI with the name or IP address of your Infoblox Grid Master.</P>Fri, 28 Oct 2016 16:44:34 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/8125#M849ccrossen2016-10-28T16:44:34ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/8631#M960
<P>Is there an option to add a host without adding it to DNS? Our appliance is not currently authoritative for the fqdn but we want to use it as an IP manager.</P><P>&nbsp;</P><P>I get</P><P>Traceback (most recent call last):<BR />&nbsp; File "&lt;pyshell#30&gt;", line 1, in &lt;module&gt;<BR />&nbsp;&nbsp;&nbsp; resp2=x.create_host_record(newip,'testauto.mydomain.com')<BR />&nbsp; File "C:/Python27/projects/ibx/src/apitest.py", line 107, in create_host_record<BR />&nbsp;&nbsp;&nbsp; raise InfobloxGeneralException(r_json['text'])<BR />InfobloxGeneralException: Cannot add records to a zone that is not authoritative</P><P>&nbsp;</P><P>Thanks.</P>Tue, 03 Jan 2017 04:10:34 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/8631#M960tgraham22017-01-03T04:10:34ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/8632#M961
<P>Hi tgraham2,</P><P>&nbsp;</P><P>If you use the record:host object and set&nbsp;'configure_for_dns' to False you are able to create a static host record in InfoBlox. Here's some (untested) python code that should help you out.</P><P>&nbsp;</P><PRE>import requests
host = 'infoblox.yourdomain.com'
api_version = 'v2.3'
url = "https://{}/wapi{}/record:host".format(host, api_version)
ip_addresses = [
{
'ipv4addr': '10.0.0.1'
}
]
payload = {
'configure_for_dns': False,
'name': 'MyFirstStaticHost',
'ipv4addrs': ip_addresses,
}
requests.post(url, data=json.dumps(payload))<BR />
</PRE><P>&nbsp;</P><P>Regards,</P><P>Thiezn</P>Tue, 03 Jan 2017 08:17:02 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/8632#M961mmortimer2017-01-03T08:17:02ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/8634#M962
Another option is to create a zone (.local or ipam.local or whatever works for you) and add the host object there. This provides another mechanism for finding all hosts in one area. Hosts without DNS entries are scattered in the subnets they are defined in. Using a zone that you create for this purpose would provide you with a consistent location to find them.<BR /><BR />When you define the zone, you would create it as an authoritative zone but you could choose to disable it or even just create it without assigning it to any DNS members.Tue, 03 Jan 2017 14:32:18 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/8634#M962DSmith2017-01-03T14:32:18ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/8983#M1019
<P>Hello together,</P><P>&nbsp;</P><P>i am having some problems creating A-records via WAPI and I hope someone might help me.</P><P>&nbsp;</P><P>My REST Call looks like this:</P><P>POST <A href="https://some.host/wapi/v2.3/record:a" target="_blank">https://some.host/wapi/v2.3/record:a</A></P><P>Content Type is set to "application/json"</P><P>&nbsp;</P><P>My JSON looks like this:</P><P>{<BR />&nbsp; &nbsp; "ipv4addrs": "1.2.3.4",<BR />&nbsp; &nbsp; "name": "host.domain.com"<BR />}</P><P>&nbsp;</P><P>(Obviously the values are changed but the setup should be the same)</P><P>&nbsp;</P><P>I always get a "400 - Bad Request" return and I don't know why.</P><P>&nbsp;</P><P>I tried to enter the view name too, but that didn't change a thing (the view I entered is the default view, namely 'Microsoft').</P><P>&nbsp;</P><P>I'd appreciate if someone could help me, I'm running out of ideas.</P><P>&nbsp;</P><P>Thanks in advance and best regards,</P><P>Patrick</P>Wed, 08 Feb 2017 08:40:54 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/8983#M1019preher2017-02-08T08:40:54ZRe: Use ipv4addrs+ to add one or more IP addresses to host recordhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/10527#M1281
<P>Hi,&nbsp;</P><P>&nbsp;</P><P>I try the first part of your code, as follows (using python 3.4):</P><P><BR />import requests<BR />import sys<BR />import json</P><P>&nbsp;</P><P>request_params = {'name': 'fred14.domain-here'}<BR />r = requests.get('https://<SPAN>10.26.77.230</SPAN>/wapi/v1.0/record:host',<BR />&nbsp; &nbsp; &nbsp; verify=False,<BR />&nbsp; &nbsp; &nbsp; params=request_params,<BR />&nbsp; &nbsp; &nbsp; auth=('username-here','password-here'))<BR />host_ref = r.json()[0]['_ref']</P><P>&nbsp;</P><P>and I get this error:</P><P>&nbsp;</P><P>Traceback (most recent call last):<BR />File "./chassis.py", line 13, in &lt;module&gt;<BR />host_ref = r.json()[0]['_ref']<BR />IndexError: list index out of range</P><P>&nbsp;</P><P>I think it's complaining about '_ref' not being a valid numerical index. &nbsp;What's intent and goal of putting '_ref' there?</P><P>&nbsp;</P><P>I know that's a valid record, as if I query with nslookup, I get:</P><P>&nbsp;</P><P>$ nslookup fred14.aw.domain-here<BR />~ │10.26.77.230<BR />~ │Server: 10.26.77.230<BR />~ │Address: 10.26.77.230#53<BR />~ │<BR />~ │Name: fred14.aw.domain-here<BR />~ │Address: 10.223.2.1</P><P>&nbsp;</P><P>I also see the same thing in the Infoblox GUI.&nbsp;</P><P>&nbsp;</P><P>It seems there isn't anything pulled in the request from the grid master. &nbsp;When I change the last three lines to the following:</P><P>&nbsp;</P><P>host_ref = r.json()<BR />print(dir(host_ref))<BR />print(host_ref)</P><P>&nbsp;</P><P>and run it, I get this:</P><P>&nbsp;</P><P>['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']<BR />[]</P><P>&nbsp;</P><P>But again, this doesn't make sense; I should see the same as what I'm seeing in nslookup as well as the Infoblox GUI. &nbsp;Anybody have thoughts on what I'm missing?</P>Tue, 25 Jul 2017 01:36:53 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/10527#M1281burvil2017-07-25T01:36:53ZRe: Use ipv4addrs+ to add one or more IP addresses to host recordhttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/10528#M1282
<P>Hi,&nbsp;</P><P>&nbsp;</P><P>I try the first part of your code, as follows (using python 3.4):</P><P><BR />import requests<BR />import sys<BR />import json</P><P>&nbsp;</P><P>request_params = {'name': 'fred14.domain-here'}<BR />r = requests.get('https://<SPAN>10.26.77.230</SPAN>/wapi/v1.0/record:host',<BR />&nbsp; &nbsp; &nbsp; verify=False,<BR />&nbsp; &nbsp; &nbsp; params=request_params,<BR />&nbsp; &nbsp; &nbsp; auth=('username-here','password-here'))<BR />host_ref = r.json()[0]['_ref']</P><P>&nbsp;</P><P>and I get this error:</P><P>&nbsp;</P><P>Traceback (most recent call last):<BR />File "./chassis.py", line 13, in &lt;module&gt;<BR />host_ref = r.json()[0]['_ref']<BR />IndexError: list index out of range</P><P>&nbsp;</P><P>I think it's complaining about '_ref' not being a valid numerical index. &nbsp;What's intent and goal of putting '_ref' there?</P><P>&nbsp;</P><P>I know that's a valid record, as if I query with nslookup, I get:</P><P>&nbsp;</P><P>$ nslookup fred14.aw.domain-here<BR />~ │10.26.77.230<BR />~ │Server: 10.26.77.230<BR />~ │Address: 10.26.77.230#53<BR />~ │<BR />~ │Name: fred14.aw.domain-here<BR />~ │Address: 10.223.2.1</P><P>&nbsp;</P><P>I also see the same thing in the Infoblox GUI.&nbsp;</P><P>&nbsp;</P><P>It seems there isn't anything pulled in the request from the grid master. &nbsp;When I change the last three lines to the following:</P><P>&nbsp;</P><P>host_ref = r.json()<BR />print(dir(host_ref))<BR />print(host_ref)</P><P>&nbsp;</P><P>and run it, I get this:</P><P>&nbsp;</P><P>['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']<BR />[]</P><P>&nbsp;</P><P>But again, this doesn't make sense; I should see the same as what I'm seeing in nslookup as well as the Infoblox GUI. &nbsp;Anybody have thoughts on what I'm missing?</P>Tue, 25 Jul 2017 01:39:33 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/10528#M1282burvil2017-07-25T01:39:33ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/11076#M1367
<P>&nbsp;</P><P>Patrick-</P><P>&nbsp;</P><P>Your problem is a simple typo in your JSON. &nbsp;The record:a object expects an "ipv4addr" (singular) parameter, not "ipv4addrs" (plural). It's an easy mistake to make because record:host does actually use "ipv4addrs" (plural).</P>Wed, 06 Sep 2017 21:19:16 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/11076#M1367rmbolger2017-09-06T21:19:16ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/11819#M1455
<BLOCKQUOTE><HR /><LI-USER uid="20938"></LI-USER> wrote:<BR /><P>Hi, thanks very much for the overview.</P><P>&nbsp;</P><P>I was wondering if there is a way to retrieve all the extensible attributes from InfoBlox?</P><P>&nbsp;</P><P>We've created a few extensible attributes as a list that contain our network sites and countries. I would like to be able to retrieve (and possibly even edit) all configured list values through the API. Looking at the API documentation there doesn't seem to be a REST&nbsp;object for this so would require us to retrieve all objects and extract the data from there.</P><P>&nbsp;</P><P>Regards,</P><P>Matt</P><HR /></BLOCKQUOTE><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>I had to do the same to update an attribute that contained a fixed list.&nbsp; To do this, I had to use the Perl API as the Web API does not allow for CRUD changes on Attributes.</P>Thu, 16 Nov 2017 19:23:37 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/11819#M1455JLeveillee2017-11-16T19:23:37ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/12140#M1491
<P>I am wondering if it is possible to do a search with the wapi and do an offset? With test and internal sites coming up first, and the limitations on the number of objects I can return from a search, I would like to offset where it is pulling the data.</P>Tue, 09 Jan 2018 18:54:08 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/12140#M1491cfedson2018-01-09T18:54:08ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/12141#M1492
<P>I think what you are looking for is _paging and _page_id</P>Tue, 09 Jan 2018 19:02:50 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/12141#M1492DRudder2018-01-09T19:02:50ZRe: The definitive list of REST exampleshttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/12142#M1493
<P>Thank you, I will look into that.</P>Tue, 09 Jan 2018 19:07:54 GMThttps://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/m-p/12142#M1493cfedson2018-01-09T19:07:54Z