Value Must Be Unique
An entity already exists with this value
Summary
If you receive this error then you have supplied a value that already exists in the system.
For example, if you attempt to create a new Company with the same name that is already in the system, then you will receive this error response for the Name property.
curl -X POST -H "Authorization: ApiKey {ApiKey}" \
-H "Content-Type: application/json" \
--data "{\"Name\": \"Awesome Inc.\"}" \
https://api.youmanage.co.uk/companies
{
"error": {
"code": "YM1000",
"reference": "https://developer.youmanage.co.uk/api/errors/ym1000",
"target": "Validation",
"message": "Validation failed",
"details": [
{
"code": "YM1008",
"reference": "https://developer.youmanage.co.uk/api/errors/ym1008",
"target": "Name",
"message": "A unique value is required",
"details": null
}
]
}
}
Solution
Ensure that the value you are submitting is unique within the system. You can filter a Collection Endpoint to ensure that the value does not exist before resubmitting the request.
curl -X POST -H "Authorization: ApiKey {ApiKey}" \
-H "Content-Type: application/json" \
--data "{\"Name\": \"Unique Company\"}" \
https://api.youmanage.co.uk/companies
{
"id": 11,
"name": "Unique Company",
"enabled": false
}