0

I am working on a script where I am creating VM and assigning available IP address to it given by concerned team. I need to integrate Infoblox API functionality with this

Once the IP is assigned,

  1. I have to find the status of that particular IP address and

    • This part I got the request

https://url/wapi/v2.10.5/ipv4address?ip_address=10.1.0.0

  1. 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 against IP address

Sample API Response


    [
        {
            "_ref": "ipv4address/Li5pcHY0X2FkZHJlc3MkMTAuMTI0LjExLjIvMA:10.1.1.2",
            "ip_address": "10.1.1.2",
            "is_conflict": false,
            "mac_address": "",
            "names": [],
            "network": "10.1.1.0/7",
            "network_view": "default",
            "objects": [],
            "status": "UNUSED",
            "types": [],
            "usage": []
        }
    ]

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\"]}'"
}**
Mike Pennington
  • 41,899
  • 19
  • 136
  • 174
Empty Coder
  • 589
  • 6
  • 19
  • If you assign that IP to a system, shouldn’t the status automatically switch to `USED`? I looked over their API and didn’t see an example of changing that status like you are trying. – AdminOfThings Aug 03 '21 at 11:51
  • @AdminOfThings:Currently team is doing the status change manually. – Empty Coder Aug 03 '21 at 11:56
  • It looks like to me the `status` field is not an array. So I would not surround the value in `[]` in your `PUT` request. – AdminOfThings Aug 03 '21 at 12:48

0 Answers0