Infoblox WAPI Cheat Sheet
· 9 min read
A quick reference for the Infoblox Web API (WAPI), a RESTful interface for managing DNS, DHCP, and IPAM. Skim the quick-reference table if you just need a reminder, scroll down for full examples.
Quick Reference
| Action | Method | Endpoint |
|---|---|---|
| Get object by ref | GET | /wapi/v2.12/<object_ref> |
| Search objects | GET | /wapi/v2.12/<object_type>?<filters> |
| Create object | POST | /wapi/v2.12/<object_type> |
| Update object | PUT | /wapi/v2.12/<object_ref> |
| Delete object | DELETE | /wapi/v2.12/<object_ref> |
| Function call | POST | /wapi/v2.12/<object_ref>?_function=<name> |
| Schema info | GET | /wapi/v2.12/<object_type>?_schema |
| API version | GET | /wapi/v2.12/?_schema |
Common Patterns
Copy-paste recipes for everyday scenarios.
# Base URL (set once)
GRID="https://grid-master.example.com"
WAPI="$GRID/wapi/v2.12"
# Basic auth (all examples below assume these vars)
AUTH="-u admin:password"
# Get the WAPI schema (list all object types)
curl -sk $AUTH "$WAPI/?_schema"
# Get schema for a specific object type
curl -sk $AUTH "$WAPI/record:a?_schema"
# Search with return fields
curl -sk $AUTH "$WAPI/record:a?name=web01.example.com&_return_fields=name,ipv4addr,ttl"
# Pretty-print JSON response
curl -sk $AUTH "$WAPI/record:a?name=web01.example.com" | python3 -m json.tool
Authentication
# Basic auth
curl -sk -u admin:password "$WAPI/grid"
# Session-based auth (get cookie)
curl -sk -u admin:password -c cookies.txt \
"$WAPI/grid"
# Reuse session cookie (no password needed)
curl -sk -b cookies.txt "$WAPI/record:a?_max_results=5"
# Logout / invalidate session
curl -sk -b cookies.txt -X POST "$WAPI/logout"
DNS Records
A Record
# Create an A record
curl -sk $AUTH -X POST "$WAPI/record:a" \
-H "Content-Type: application/json" \
-d '{"name":"web01.example.com","ipv4addr":"10.0.0.50","view":"default"}'
# Search A records by name
curl -sk $AUTH "$WAPI/record:a?name=web01.example.com"
# Search A records by IP
curl -sk $AUTH "$WAPI/record:a?ipv4addr=10.0.0.50"
# Search with regex (~ prefix)
curl -sk $AUTH "$WAPI/record:a?name~=web.*\.example\.com"
# Update an A record (use object ref from search)
curl -sk $AUTH -X PUT "$WAPI/record:a/ZG5z...:web01.example.com/default" \
-H "Content-Type: application/json" \
-d '{"ipv4addr":"10.0.0.51"}'
# Delete an A record
curl -sk $AUTH -X DELETE "$WAPI/record:a/ZG5z...:web01.example.com/default"
AAAA Record
# Create an AAAA record
curl -sk $AUTH -X POST "$WAPI/record:aaaa" \
-H "Content-Type: application/json" \
-d '{"name":"web01.example.com","ipv6addr":"2001:db8::50","view":"default"}'
# Search AAAA records
curl -sk $AUTH "$WAPI/record:aaaa?name=web01.example.com"
CNAME Record
# Create a CNAME record
curl -sk $AUTH -X POST "$WAPI/record:cname" \
-H "Content-Type: application/json" \
-d '{"name":"www.example.com","canonical":"web01.example.com","view":"default"}'
# Search CNAME records
curl -sk $AUTH "$WAPI/record:cname?name=www.example.com"
MX Record
# Create an MX record
curl -sk $AUTH -X POST "$WAPI/record:mx" \
-H "Content-Type: application/json" \
-d '{"name":"example.com","mail_exchanger":"mail.example.com","preference":10,"view":"default"}'
TXT Record
# Create a TXT record
curl -sk $AUTH -X POST "$WAPI/record:txt" \
-H "Content-Type: application/json" \
-d '{"name":"example.com","text":"v=spf1 include:_spf.example.com ~all","view":"default"}'
PTR Record
# Create a PTR record
curl -sk $AUTH -X POST "$WAPI/record:ptr" \
-H "Content-Type: application/json" \
-d '{"ptrdname":"web01.example.com","ipv4addr":"10.0.0.50","view":"default"}'
# Search PTR by IP
curl -sk $AUTH "$WAPI/record:ptr?ipv4addr=10.0.0.50"
SRV Record
# Create an SRV record
curl -sk $AUTH -X POST "$WAPI/record:srv" \
-H "Content-Type: application/json" \
-d '{"name":"_sip._tcp.example.com","port":5060,"priority":10,"target":"sip.example.com","weight":100}'
Host Record (A + PTR combined)
# Create a host record with a specific IP
curl -sk $AUTH -X POST "$WAPI/record:host" \
-H "Content-Type: application/json" \
-d '{"name":"db01.example.com","ipv4addrs":[{"ipv4addr":"10.0.0.100"}]}'
# Create a host record with next available IP
curl -sk $AUTH -X POST "$WAPI/record:host" \
-H "Content-Type: application/json" \
-d '{"name":"db02.example.com","ipv4addrs":[{"ipv4addr":"func:nextavailableip:10.0.0.0/24"}]}'
# Search host records
curl -sk $AUTH "$WAPI/record:host?name=db01.example.com&_return_fields=name,ipv4addrs"
Networks and IPAM
# List all networks
curl -sk $AUTH "$WAPI/network?_max_results=50&_return_fields=network,comment,extattrs"
# Search for a specific network
curl -sk $AUTH "$WAPI/network?network=10.0.0.0/24"
# Create a network
curl -sk $AUTH -X POST "$WAPI/network" \
-H "Content-Type: application/json" \
-d '{"network":"10.0.1.0/24","comment":"App tier"}'
# Get next available IP from a network
curl -sk $AUTH -X POST "$WAPI/network/ZG5z...:10.0.0.0/24/default?_function=next_available_ip" \
-H "Content-Type: application/json" \
-d '{"num":1}'
# Get multiple next available IPs
curl -sk $AUTH -X POST "$WAPI/network/ZG5z...:10.0.0.0/24/default?_function=next_available_ip" \
-H "Content-Type: application/json" \
-d '{"num":5,"exclude":["10.0.0.1","10.0.0.2"]}'
# Search for a network by CIDR (contains)
curl -sk $AUTH "$WAPI/network?network~=10.0"
# List IP addresses in a network (ipv4address search)
curl -sk $AUTH "$WAPI/ipv4address?network=10.0.0.0/24&status=USED&_return_fields=ip_address,names,status"
Network Containers
# List network containers
curl -sk $AUTH "$WAPI/networkcontainer?_return_fields=network,comment"
# Create a network container
curl -sk $AUTH -X POST "$WAPI/networkcontainer" \
-H "Content-Type: application/json" \
-d '{"network":"10.0.0.0/16","comment":"Production supernet"}'
# Get next available network from a container
curl -sk $AUTH -X POST "$WAPI/networkcontainer/ZG5z...:10.0.0.0/16/default?_function=next_available_network" \
-H "Content-Type: application/json" \
-d '{"cidr":24,"num":1}'
DHCP
Ranges
# Create a DHCP range
curl -sk $AUTH -X POST "$WAPI/range" \
-H "Content-Type: application/json" \
-d '{"start_addr":"10.0.0.100","end_addr":"10.0.0.200","network":"10.0.0.0/24"}'
# List DHCP ranges
curl -sk $AUTH "$WAPI/range?network=10.0.0.0/24&_return_fields=start_addr,end_addr,network"
Fixed Addresses (Reservations)
# Create a DHCP reservation
curl -sk $AUTH -X POST "$WAPI/fixedaddress" \
-H "Content-Type: application/json" \
-d '{"ipv4addr":"10.0.0.50","mac":"00:11:22:33:44:55","name":"printer01"}'
# Search reservations by MAC
curl -sk $AUTH "$WAPI/fixedaddress?mac=00:11:22:33:44:55"
# Search reservations by IP
curl -sk $AUTH "$WAPI/fixedaddress?ipv4addr=10.0.0.50"
Leases
# Search active leases
curl -sk $AUTH "$WAPI/lease?address=10.0.0.150&_return_fields=address,hardware,client_hostname,ends"
# Find all leases in a network
curl -sk $AUTH "$WAPI/lease?network=10.0.0.0/24&_max_results=100"
DNS Zones
# List all authoritative zones
curl -sk $AUTH "$WAPI/zone_auth?_return_fields=fqdn,view,zone_format"
# Create a forward zone
curl -sk $AUTH -X POST "$WAPI/zone_auth" \
-H "Content-Type: application/json" \
-d '{"fqdn":"app.example.com","view":"default","zone_format":"FORWARD"}'
# Create a reverse zone
curl -sk $AUTH -X POST "$WAPI/zone_auth" \
-H "Content-Type: application/json" \
-d '{"fqdn":"0.0.10.in-addr.arpa","view":"default","zone_format":"IPv4"}'
# Restart DNS service (apply pending changes)
curl -sk $AUTH -X POST "$WAPI/grid/b25lLm...?_function=restartservices" \
-H "Content-Type: application/json" \
-d '{"restart_option":"RESTART_IF_NEEDED","service_option":"ALL"}'
Searching and Filtering
| Modifier | Meaning | Example |
|---|---|---|
| (none) | Exact match | ?name=web01.example.com |
~= | Regex match | ?name~=^web\d+ |
<= | Less than or equal | ?ipv4addr<=10.0.0.100 |
>= | Greater than or equal | ?ipv4addr>=10.0.0.50 |
:= | Case-insensitive | ?name:=WEB01.EXAMPLE.COM |
! (prefix) | Negation | ?name!=localhost |
# Regex search: all records matching a pattern
curl -sk $AUTH "$WAPI/record:a?name~=prod.*\.example\.com"
# Search by extensible attribute
curl -sk $AUTH "$WAPI/record:a?*Site=NYC&_return_fields=name,ipv4addr,extattrs"
# Negative search: all except a specific view
curl -sk $AUTH "$WAPI/record:a?view!=internal"
Return Fields and Paging
# Specify which fields to return
curl -sk $AUTH "$WAPI/record:a?_return_fields=name,ipv4addr,ttl,comment,extattrs"
# Include basic fields plus extras
curl -sk $AUTH "$WAPI/record:a?_return_fields%2B=ttl,comment"
# Limit results
curl -sk $AUTH "$WAPI/record:a?_max_results=10"
# Paging: get first page
curl -sk $AUTH "$WAPI/record:a?_max_results=100&_paging=1&_return_as_object=1"
# Response includes "_next_page_id" → use it for next page:
curl -sk $AUTH "$WAPI/record:a?_page_id=<page_id_from_response>"
Extensible Attributes
# Create a record with extensible attributes
curl -sk $AUTH -X POST "$WAPI/record:a" \
-H "Content-Type: application/json" \
-d '{
"name":"web01.example.com",
"ipv4addr":"10.0.0.50",
"extattrs":{"Site":{"value":"NYC"},"Environment":{"value":"Production"}}
}'
# Search by extensible attribute (prefix with *)
curl -sk $AUTH "$WAPI/record:a?*Environment=Production"
# Update extensible attributes on an existing object
curl -sk $AUTH -X PUT "$WAPI/record:a/ZG5z...:web01.example.com/default" \
-H "Content-Type: application/json" \
-d '{"extattrs":{"Site":{"value":"LAX"},"Environment":{"value":"Staging"}}}'
Grid and Members
# Get grid info
curl -sk $AUTH "$WAPI/grid?_return_fields=name,service_status"
# List grid members
curl -sk $AUTH "$WAPI/member?_return_fields=host_name,platform,service_status"
# Restart services on the grid
curl -sk $AUTH -X POST "$WAPI/grid/b25lLm...?_function=restartservices" \
-H "Content-Type: application/json" \
-d '{"restart_option":"RESTART_IF_NEEDED","service_option":"ALL"}'
CSV Import / Export
# Start a CSV import task
curl -sk $AUTH -X POST "$WAPI/fileop?_function=uploadinit" \
-H "Content-Type: application/json" \
-d '{"filename":"import.csv"}'
# Returns upload_url and upload_token
# Upload the CSV file
curl -sk $AUTH -X POST "<upload_url>" \
-F "file=@import.csv"
# Trigger the CSV import
curl -sk $AUTH -X POST "$WAPI/fileop?_function=csv_import" \
-H "Content-Type: application/json" \
-d '{"token":"<upload_token>","on_error":"STOP","operation":"INSERT","separator":"COMMA"}'
# Check CSV task status
curl -sk $AUTH "$WAPI/csvimporttask?_return_fields=status,lines_processed,lines_failed"
# CSV Export
curl -sk $AUTH -X POST "$WAPI/fileop?_function=csv_export" \
-H "Content-Type: application/json" \
-d '{"_object":"record:a"}'
Scheduled Operations
# Create a record with a scheduled time
curl -sk $AUTH -X POST "$WAPI/record:a?_schedinfo.scheduled_time=1714500000" \
-H "Content-Type: application/json" \
-d '{"name":"future.example.com","ipv4addr":"10.0.0.99"}'
# List pending scheduled tasks
curl -sk $AUTH "$WAPI/scheduledtask?_return_fields=scheduled_time,submit_time,task_type,approval_status"
# Execute a scheduled task immediately
curl -sk $AUTH -X POST "$WAPI/scheduledtask/ZG5z...?_function=execute_now"
Useful Tips
# Use _return_as_object=1 for metadata (e.g., paging info)
curl -sk $AUTH "$WAPI/record:a?_return_as_object=1&_max_results=5"
# Discover supported WAPI versions
curl -sk $AUTH "$GRID/wapi/v1.0/?_schema"
# Set TTL on a record
curl -sk $AUTH -X PUT "$WAPI/record:a/ZG5z...:web01.example.com/default" \
-H "Content-Type: application/json" \
-d '{"ttl":300,"use_ttl":true}'
# Disable a record (without deleting)
curl -sk $AUTH -X PUT "$WAPI/record:a/ZG5z...:web01.example.com/default" \
-H "Content-Type: application/json" \
-d '{"disable":true}'
# Bulk delete with a script (search → delete each ref)
curl -sk $AUTH "$WAPI/record:a?name~=temp.*\.example\.com" | \
python3 -c "import sys,json; [print(r['_ref']) for r in json.load(sys.stdin)]" | \
while read ref; do curl -sk $AUTH -X DELETE "$WAPI/$ref"; done
