Conflicts With Existing Record

The values for this property would conflict with another entity

Purple gradient wave Purple wave used to give a visual break between the header and body of the page.

Summary

This error can happen when you have supplied data that if saved would conflict with an existing entity.

For example, if you are trying to create a new Holiday entity on the Absences endpoint and you have supplied dates that overlap with another absence then you will receive this error response.

curl -X POST \
  https://api.youmanage.co.uk/Absences \
  -H 'Authorization: ApiKey {ApiKey}' \
  -H 'Content-Type: application/json' \
  -d '{
    "Type": "Holiday",
    "Reason": "Annual Leave",
    "CreatorId": 2,
    "EmployeeId": 3,
    "Start": "2019-03-23T09:34:56Z",
    "End": "2019-03-24T00:00:00Z",
    "Period": {
        "Days": 1,
        "Hours": 7.5
    }
}'
{
  "error": {
    "code": "YM1000",
    "reference": "https://developer.youmanage.co.uk/api/errors/ym1000",
    "target": "Validation",
    "message": "Validation failed",
    "details": [
      {
        "code": "YM1002",
        "reference": "https://developer.youmanage.co.uk/api/errors/ym1002",
        "target": "End",
        "message": "Validation failed for a specific property",
        "details": [
          {
            "code": "YM1017",
            "reference": "https://developer.youmanage.co.uk/api/errors/ym1017",
            "target": "End",
            "message": "This would conflict with an existing record",
            "details": null
          }
        ]
      },
      {
        "code": "YM1002",
        "reference": "https://developer.youmanage.co.uk/api/errors/ym1002",
        "target": "Start",
        "message": "Validation failed for a specific property",
        "details": [
          {
            "code": "YM1017",
            "reference": "https://developer.youmanage.co.uk/api/errors/ym1017",
            "target": "Start",
            "message": "This would conflict with an existing record",
            "details": null
          }
        ]
      }
    ]
  }
}

  

Solution

Ensure that the data you are supplying does not conflict with other entities in the system. You can make use of collection endpoint filtering to check for conflicts and display these to the user or take action as required.