Hi,
If you make the “Display Name” default field unique as shown in the following screenshot:
and if you try to make a call to update an asset (e.g. PUT https://[instance]/api/v2/assets/8615/) with a payload like:
{
"description": "abcd",
"end_of_life": null,
"type_fields": {
"provider_type_16000480427": "VMWARE VCENTER",
"item_id_16000797861": " ",
"memory_size_16000797861": 0,
"datastore_16000797862": " ",
"cpu_core_count_16000797861": 0,
"cpu_speed_16000797862": 0,
"cluster_16000797862": " ",
"instance_uuid_16000797862": " ",
"hardware_vendor_16000797862": " ",
"datacenter_16000797862": " ",
"cd_serial_number_16000797862": " ",
"ip_address_16000797861": " ",
"os_type_16000797862": "ESXi",
"total_disk_size_16000797861": 0,
"cloud_cost_16000480427": 0,
"item_name_16000797861": " ",
"hypervisor_16000797862": "ESXi ",
"state_16000797861": "Unknown"
},
"asset_type_id": 16000797862,
"name": "Test VCenter Host"
}
the API call will fail with a 400 error:
{
"description": "Validation failed",
"errors": [
{
"field": "base",
"message": "Display Name must be unique",
"code": "invalid_value"
}
]
}
if an asset with the same name as the one you are trying update exists in the trash.
If an asset with the same name did not exist in the trash, then the update of the asset is successful (200 status code). Here is the successful response:
{
"description": "abcd",
"end_of_life": null,
"type_fields": {
"provider_type_16000480427": "VMWARE VCENTER",
"item_id_16000797861": " ",
"memory_size_16000797861": 0,
"datastore_16000797862": " ",
"cpu_core_count_16000797861": 0,
"cpu_speed_16000797862": 0,
"cluster_16000797862": " ",
"instance_uuid_16000797862": " ",
"hardware_vendor_16000797862": " ",
"datacenter_16000797862": " ",
"cd_serial_number_16000797862": " ",
"ip_address_16000797861": " ",
"os_type_16000797862": "ESXi",
"total_disk_size_16000797861": 0,
"cloud_cost_16000480427": 0,
"item_name_16000797861": " ",
"hypervisor_16000797862": "ESXi ",
"state_16000797861": "Unknown"
},
"asset_type_id": 16000797862,
"name": "Test VCenter Host"
}
Note also that even if I try to add or update an asset which has the same name as one in the trash and if Display Name field is marked as unique, the UI shows the error “Display Name must be unique”.
Should I be able to add or update an asset even if one with the same name exists in the trash if the Display Name field is marked as unique?
Thanks,
Chris