What are the ids on the type_fields for assets?

When using the /api/v2/assets?include=type_fields endpoint some of the attribute keys have numbers after them, but I’m not sure what they represent or how to work out what they will be. For example:

"os_29002755953"=>"Mac", "computer_ip_address_29002755953"=>"192.168.55.254"

In the example above where does the 29002755953 come from?

1 Like

Hello @mccarths the number that you are seeing is the Parent Asset Type ID appended to the end of the property.

For example if you had an asset type of “Computer” that has an asset_type_id of ‘1234’ and you had a child asset type of “Laptop” with an asset_type_id of ‘5678’, when you get the asset data for the Laptop you would get asset type properties like “serial_number_1234” and “os_1234”. Because those properties are defined in the “Computer” asset type.

Hope that helps!!

2 Likes

Thanks Zachary. The problem I’m having is that I’d like to be able to grab the OS for example of each asset, like asset[“type_fields”][“os”], but instead I’m having to loop through all the keys in the type_fields hash and look for something that look like “os_/some number/”. Is that the only way to do it?

1 Like

Hello @mccarths do you have the OS field on more than one Asset Type? If not then the property name is going to be consistent (ex. os_1234) and you can use it to reference that field on every asset (ex. asset[“type_fields”][“os_1234”]).