- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
REST API - Creating a list of DNS host records using a signe HTTP connexion
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 02:39 AM
My question is: Is there a way to assign a list of records to the data field of the request to create multiple records with a single connection ? (Avoiding connection opening and closure on every request, and using only one for all)
Thank you,
C.B
Re: REST API - Creating a list of DNS host records using a signe HTTP connexion
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 02:55 AM - edited 06-13-2019 02:56 AM
Hi,
You can use either of the following options:
- Import a CSV file that comtains the Host Records.
This is covered in this document on page 89 (Import a CSV file) - Using the Multiple Object Body function using the /request endpoint
Operation
REST Method
API Call
Sample Body
Sample cURL Command
Sample Output
Create multiple host records
POST
<wapi_url>/request
[{"method": "POST",
"object": "record:host",
"data": {"name":"host-1.info.com",
"ipv4addrs": [{"ipv4addr":"10.10.10.21"}]},
"assign_state": {"host1_ref": "_ref"},
"enable_substitution": true,
"discard": true},{"method": "POST",
"object": "record:host",
"data": {"name":"host-2.info.com",
"ipv4addrs": [{"ipv4addr":"10.10.10.22"}]},
"assign_state": {"host2_ref": "_ref"},
"enable_substitution": true,
"discard": true},
{"method": "STATE: DISPLAY"}]curl -k -u admin:Infoblox -H 'content-type:application/json' -X POST "https://grid-master/wapi/v2.10/request" -d '[{"method": "POST","object": "record:host","data": {"name":"host-1.info.com","ipv4addrs": [{"ipv4addr":"10.10.10.21"}]},"assign_state": {"host1_ref": "_ref"},"enable_substitution": true,"discard": true},{"method": "POST","object": "record:host","data": {"name":"host-2.info.com", "ipv4addrs": [{"ipv4addr":"10.10.10.22"}]},"assign_state": {"host2_ref": "_ref"},"enable_substitution": true,"discard": true},{"method": "STATE: DISPLAY"}]'
[{"host1_ref": "record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5pbmZvLmhvc3QtMQ:host-1.info.com/default",
"host2_ref": "record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5pbmZvLmhvc3QtMg:host-2.info.com/default"}]
Re: REST API - Creating a list of DNS host records using a signe HTTP connexion
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 03:04 AM
I will carry out this solution on my work.