- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Modify IPv4 Address with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 01:05 AM
Hi,
Can I modify IPv4 Address with API ?
I googled but most of my findings are says Its not possible to modify existing IP Addrs with API.
Thanks for help!
Regards
Re: Modify IPv4 Address with WAPI
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 02:15 AM - edited 02-20-2023 03:17 AM
Hello,
Are you trying to modify an existing IP address assigned to a host record?
If thats what you want to do you can modify it using API
You can get the associated IP addresses for the host using API, get the _ref for the IP you want to modify, and then do a PUT request to modify the IP.
Example queries.
https://<grid-ip>/wapi/v2.10/record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5pbmZvLmhvc3Qx:host1.info.com/default
Sample Output
{ "_ref": "record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5pbmZvLmhvc3Qx:host1.info.com/default", "ipv4addrs": [ { "_ref": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQuY29tLmluZm8uaG9zdDEuMTAuMTAuMTAuMjEu:10.10.10.21/host1.info.com/default", "configure_for_dhcp": false, "host": "host1.info.com", "ipv4addr": "10.10.10.21" } ], "name": "host1.info.com", "view": "default" }
Example PUT request.
curl -L -X PUT 'https://<grid-ip>/wapi/v2.10/record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQuY29tLmluZm8uaG9zdDEuMTAuMTAuMTAuMjEu:10.10.10.21/host1.info.com/default' -H 'Content-Type: application/json' -H --data-raw '{ "ipv4addr": "10.10.10.20" }'
Re: Modify IPv4 Address with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2023 04:48 AM
Hi Shukran,
Thanks for reply.
Can I Modify A record Ip Address ? I try to replace host with a record but i cannot run that .
Regards,
Re: Modify IPv4 Address with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2023 10:32 AM
As Shukran said, you can modify the record by doing a PUT against that record. If it is an A-Record you want to modify (including IP Address), you will have to get the A-Record reference. (i.e. record:a/ZG5zLmJpbmRfYSQuX2RlZtLmJtYyxyZGV2cmllcywxMC4wLjAuNQ:test.mydomain.org/default).
If you're trying to modify a host record, you will need to get the host record reference.
I just tried changing the IP Address on one of my A-Records, and it works flawlessly with a PUT.
Re: Modify IPv4 Address with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2023 11:36 PM
Hi,
I understood the logic, I was getting an error because I wrote ipv4_addr after A record.
Thank you very much for your answers.