User Tools

Site Tools


infoblox:api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
infoblox:api [2025/11/23 11:48] bstaffordinfoblox:api [2026/03/07 00:25] (current) bstafford
Line 1: Line 1:
 ====== BloxOne API ====== ====== BloxOne API ======
 ([[infoblox:api#nios|NIOS further down the page]]) ([[infoblox:api#nios|NIOS further down the page]])
 +
  
 REMEMBER, in Linux you can pipe output into "jq" which will format the output as a response to JSON query. REMEMBER, in Linux you can pipe output into "jq" which will format the output as a response to JSON query.
Line 8: Line 9:
     * [[https://github.com/infobloxopen/nios-swagger|NIOS Swagger GitHub]]     * [[https://github.com/infobloxopen/nios-swagger|NIOS Swagger GitHub]]
     * [[https://docs.infoblox.com/space/NIOS/35400616/NIOS|Official Doc Page]] linking to both of the links above.     * [[https://docs.infoblox.com/space/NIOS/35400616/NIOS|Official Doc Page]] linking to both of the links above.
 +
 +===== Convert JSON =====
 +The "jq" command is excellent for parsing JSON. 
 +
 +Page on transforming JSON with jq [[www.digitalocean.com/community/tutorials/how-to-transform-json-data-with-jq|here]].
 ===== Quick CURL===== ===== Quick CURL=====
 <code>curl -X GET -H "Authorization: Token token=<API_KEY>" "https://csp.infoblox.com/tide/api/data/threats?type=host&class=bot"</code> <code>curl -X GET -H "Authorization: Token token=<API_KEY>" "https://csp.infoblox.com/tide/api/data/threats?type=host&class=bot"</code>
  
 ===== Simple CURL ===== ===== Simple CURL =====
 +==== Quick Sample =====
 +<code>PORTAL="csp.eu.infoblox.com"
 +BASE_URL="https://$PORTAL"
 +API_TOKEN="INSERT_API_KEY_HERE"
 +curl -s -X GET \
 +-H "Content-Type: application/json" \
 +-H "Authorization: Token token=$API_TOKEN" \
 +"$BASE_URL/api/atcfw/v1/network_lists" | jq
 +CONTENT_TYPE="Content-Type: application/json"
 +AUTHORIZATION="Authorization: Token token=$API_TOKEN"</code>
 +Then you can just run
 +<code>curl -s -X GET -H "$CONTENT_TYPE" -H "$AUTHORIZATION" \
 +"$BASE_URL/api/atcfw/v1/network_lists" | jq</code>
 +
 +What you can do is insert the following lines into .bashrc to have them auto populate when you log in. Be careful about this as it exposes your API key. Nice in a lab but risky in production.
 +<code>PORTAL="csp.eu.infoblox.com"
 +BASE_URL="https://$PORTAL"
 +API_TOKEN="INSERT_API_KEY_HERE"</code>
 +
 +
 +or even
 +<code>API="/api/atcfw/v1/network_lists"
 +curl -s -X GET -H "$CONTENT_TYPE" -H "$AUTHORIZATION" "$BASE_URL$API" | jq</code>
 ==== External Networks ==== ==== External Networks ====
 API documentation [[https://csp.infoblox.com/apidoc/?url=https://csp.infoblox.com/apidoc/docs/Atcfw#/network_lists/network_listsListNetworkLists|here]]. Look for 'network_lists'. API documentation [[https://csp.infoblox.com/apidoc/?url=https://csp.infoblox.com/apidoc/docs/Atcfw#/network_lists/network_listsListNetworkLists|here]]. Look for 'network_lists'.
Line 257: Line 286:
 sys.exit(1)</code> sys.exit(1)</code>
 ===== Reference ===== ===== Reference =====
 +API Docs [[https://csp.infoblox.com/apidoc?url=https%3A%2F%2Fcsp.infoblox.com%2Fapidoc%2Fdocs%2FAtcfw#/|here]].
 +
 +===== Subnet Filter =====
 +
 +
 +<code>curl -s --location 'https://csp.eu.infoblox.com/api/ddi/v1/ipam/subnet?_offset=0&_tfilter=Type%3DHo*&_limit=5&_is_total_size_needed=true' \
 +--header 'Accept: application/json' \
 +--header 'Authorization: Token YOUR_API_KEY_HERE' \
 +| jq -r '.results[] | "\(.address)/\(.cidr)"' </code>
 +
 +This command will find all subnets that have the tag "Type" with value "Home" and return JSON data.
 +
 +You can then use the jq command to filter the subnet address value and the subnet CIDR value and display in format address/cidr
 +==== AWS IPAM ====
 +To get the Infoblox ID needed by AWS IPAM for management:
 +<code>curl -s -H "Authorization: Token <YOUR_API_KEY>" https://csp.infoblox.com/v2/current_user | jq '.result.account_infoblox_id'</code>
 +==== Get Internal Domain List ====
 +The following gets the full list of Internal Domain lists (Security) as well as their contents. You can use this to get the ID of each list.
 +<code>curl -X GET -H "Authorization: Token token=<APIKEY>" "https://csp.eu.infoblox.com/api/atcfw/v1/internal_domain_lists"</code>
 +
 +The code below is for when you want to filter the query to show just the contents of a specific list (in this case, the ID is 1234)
 +<code>curl -X GET -H "Authorization: Token token=<APIKEY>" "https://csp.eu.infoblox.com/api/atcfw/v1/internal_domain_lists/1234"</code>
 +
 ==== Get Data of Threat Feed ==== ==== Get Data of Threat Feed ====
 <code>curl -s -X GET "https://csp.infoblox.com/api/atcfw/v1/threat_feeds?_filter=((name=='AntiMalware')or(name=='FarSightNOD'))" -H "Authorization: Token token=ADD_API_KEY" -H "Content-Type: application/json"</code> <code>curl -s -X GET "https://csp.infoblox.com/api/atcfw/v1/threat_feeds?_filter=((name=='AntiMalware')or(name=='FarSightNOD'))" -H "Authorization: Token token=ADD_API_KEY" -H "Content-Type: application/json"</code>
Line 855: Line 907:
 For very large results, you may need to add ''&_paging=1&_return_as_object=1&_max_results=1000''. For very large results, you may need to add ''&_paging=1&_return_as_object=1&_max_results=1000''.
 The return object will contain a next_page_id field, which you call in the following call with the same query but adding ''&_page_id={id_string_from_next_page_id}''. The return object will contain a next_page_id field, which you call in the following call with the same query but adding ''&_page_id={id_string_from_next_page_id}''.
 +===== NIOS Perl API =====
 +The Perl API (PAPI) has been officially deprecated since NIOS version 8.4.
 +
 +Starting from NIOS version 9.0.6, Perl module access is disabled by default.
 +
 +All future enhancements and fixes are now provided through the RESTful API (WAPI).
 +
 +To enable PAPI, the following CLI command must be executed: <code>set perl_mod_access</code>
 +
 +When you enable or disable the perl_mod_access, there will be no impact but the Grid interface (GUI) will be restarted. It doesn’t cause any service impact or appliance restart.
  
infoblox/api.1763898514.txt.gz · Last modified: by bstafford