- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Adding and modifying names and comment ipv4address and network
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 01:08 PM
I have been able to assign a fixed IP and add a network via the API. I would now like to set the name of the fixed address and the comment of the network. I have tried to include the name and comment in the POST command during the add and get a bad command error. I also tried to modify the object with a PUT command and get the same error. I think my JSON must be wrong, but can't seem to figure out what is wrong. I appreciate any help!
Examples of what I have tried are below:
Adding fixed address with name:
POST : https://172.25.0.14/wapi/v2.11/fixedaddress
{
"ipv4addr" : "192.168.1.2",
"mac" : "DE:ADE:ADDD",
"names" : ["Second Fixed"]
}
Bad Command
POST : https://172.25.0.14/wapi/v2.11/fixedaddress
{
"ipv4addr" : "192.168.1.2",
"mac" : "DE:ADE:ADDD",
}
Works
Tried modifying with a PUT command:
(I had set the name in the web UI)
GET : https://172.25.0.14/wapi/v2.11/ipv4address?ip_address=192.168.1.2
[{
"_ref" : "ipv4address/Li5pcHY0X2FkZHJlc3MkMTkyLjE2OC4xLjEvMA:192.168.1.2",
"ip_address" : "192.168.1.2",
"is_conflict" : false,
"mac_address" : "de:ad:de:ad:dd:dd",
"names" : ["Innovative Test"],
"network" : "192.168.1.0/29",
"network_view" : "default",
"objects" : [
"fixedaddress/ZG5zLmZpeGVkX2FkZHJlc3MkMTkyLjE2OC4xLjEuMC4u:192.168.1.1/default"
],
"status" : "USED",
"types" : [
"FA"
],
"usage" : [
"DHCP"
]
}
]
Using the _ref from the GET command
PUT : https://172.25.0.14/wapi/v2.11/ipv4address/Li5pcHY0X2FkZHJlc3MkMTkyLjE2OC4xLjEvMA:192.168.1.2
{
"names" : ["Innovative Test 2"]
}
Bad Command
I have tried the same and had the same results with a network:
POST : https://172.25.0.14/wapi/v2.11/network
{
"network" : "192.168.1.40/30",
"comment" : "Innovative Small Subnet"
}
Bad Command
Solved! Go to Solution.
Re: Adding and modifying names and comment ipv4address and network
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 04:24 PM
You will want to post updates to the fixedaddress object
fixedaddress/ZG5zLmZpeGVkX2FkZHJlc3MkMTkyLjE2OC4xLjEuMC4u:192.168.1.1/default
The ipaddress object refers to an actual IP Address, and not to the object that is using that IP address. You can't really change atrtributes of an IP address.
Updating the comment of a Fixed Address will look something like this:
PUT : https://172.25.0.14/wapi/v2.11/fixedaddress/ZG5zLmZpeGVkX2FkZHJlc3MkMTkyLjE2OC4xLjEuMC4u:192.168.1.1/default { "comment" : "Innovative Small Subnet" }
Re: Adding and modifying names and comment ipv4address and network
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2020 06:51 AM
Thanks for the response!
That got me on the right track.
I had to use the fixedaddress object like you stated, and the name is not set by the names array like it is in the return, but is set using {"name":"New name Value"}
I appreciate your help!
Dave Anderson