Update IP status from Unused to Used

[ Edited ]
Posts: 16
852     0

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=

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:" -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

Posts: 179
853     0



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":"","ipv4addrs": [{"ipv4addr":""}]}'

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":"","ipv4addrs":[{"ipv4addr":{"_object_function":"next_available_ip","_parameters":{"exclude":["",""]},"_result_field":"ips","_object" : "network","_object_parameters":{"network":""}}}]}'

You can find more examples here.


Thanks & Regards,

Krishna Vasudevan

Showing results for 
Search instead for 
Did you mean: 

Recommended for You

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin