Ralph Asset Management System - User Group

Api: Assign ipaddress object to data-center-assert object

Hi there,
I wonder how I can connect a given data-center-asset object to a given ipadress object.
E.g. I got an asset: /api/data-center-assets/690/ and want to patch it with:

{

“hostname”: “somename”,
“ipaddresses”: [2]
}

That does not work. Can someone give me a hint here?

Micha

Hi Mik,

To add an IP address for a given machine you have to first create an ethernet object linked to your data center asset and then to create an ipaddress object linked to your ethernet component.

In practice:

POST to /api/ethernets/ with an ethernet structure:
{
[…]
“base_object”: 690
}
This returns the complete ethernet component. Save the id for later (let’s say it’s 123).

POST to /api/ipaddresses/ :
{
“hostname”: “somename”,
“ethernet”: 123
}

If you have an existing ipaddress object you can patch it to point to the correct ethernet object.

Serena

Worked. Thank you very much :slight_smile: