- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Update IP status from Unused to Used
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2021 07:52 AM - edited 08-03-2021 03:49 AM
Hi All,
I am working on a script where i am creating VM and assigning available IP address to it given by concerend team.
Now once the IP is assigned,.
1) I have to find the status of that perticular IP address and
- This part i am ok. https://url/wapi/v2.10.5/ipv4address?ip_address=10.1.0.0
2) Update the status of that IP from "Unused" to "Used".
Can you please help me with this. Need the API request to modify the status value againest IP address
****************
I was trying a PUT request like below
https://url/wapi/v2.10.5/record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5pbmZvLndhcGlhbGlhcw:10.124.11.2/default?_return_fields%2B=aliases&_return_as_object=1" -d '{"status": ["Used"]}'
but it is giving error
{
"Error": "AdmConProtoError: Invalid value for _return_as_object: 1\" -d '{\"status\": [\"Used\"]}'",
"code": "Client.Ibap.Proto",
"text": "Invalid value for _return_as_object: 1\" -d '{\"status\": [\"Used\"]}'"
}
Re: Update IP status from Unused to Used
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2021 07:20 AM
Hi,
When you create a host record against the IP address, the status automatically changes to "USED". So you wouldn't have to change that manually.
You can create a host record using this API:
curl -k -u admin:pwd -H 'content-type: application/json' -X POST "https://grid-master/wapi/v2.11/record:host?_return_fields%2B=name,ipv4addrs&_return_as_object=1" -d '{"name":"host.info.com","ipv4addrs": [{"ipv4addr":"10.10.10.20"}]}'
You can also create a host record with the next available IP in a subnet. NIOS would do the check if it is used/unused.
curl -k -u admin:pwd -H 'content-type: application/json' -X POST "https://grid-master/wapi/v2.11/record:host?_return_fields%2B=name,ipv4addrs&_return_as_object=1 " -d '{"name":"wapi.info.com","ipv4addrs":[{"ipv4addr":{"_object_function":"next_available_ip","_parameters":{"exclude":["10.10.10.1","10.10.10.2"]},"_result_field":"ips","_object" : "network","_object_parameters":{"network":"10.10.10.0/24"}}}]}'
You can find more examples here.
Thanks & Regards,
Krishna Vasudevan