Introducing SOC Insights for BloxOne Threat Defense: Boost your SOC efficiency with AI-driven insights to eliminate manual work and accelerate investigation and response times. Read the blog announcement here.

API & Integration, DevOps,NetOps,SecOps

Reply

Adding and modifying names and comment ipv4address and network

New Member
Posts: 2
4074     0

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:ADSmiley Very HappyE:ADSmiley Very HappyDSmiley Very HappyD",
    "names" : ["Second Fixed"]
}

Bad Command 

 

POST : https://172.25.0.14/wapi/v2.11/fixedaddress
{
    "ipv4addr" : "192.168.1.2",
    "mac" : "DE:ADSmiley Very HappyE:ADSmiley Very HappyDSmiley Very HappyD",
}

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

Re: Adding and modifying names and comment ipv4address and network

Moderator
Moderator
Posts: 287
4074     0

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

New Member
Posts: 2
4074     0

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

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You