Must Be One Of

The value must be from a selection of values

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

Summary

Certain properties require that the value is from a predetermined set of values. If you are receiving this error response then you have given a value that is not within the permitted values.

For example, if you are attempting to create a Toil record on the Absences endpoint then you must ensure that the Reason property has a value of either Add or Use, otherwise 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": "Toil",
    "AuthorisationMethod": "Call",
    "Reason": "Working Late",
    "CreatorId": 2,
    "EmployeeId": 3,
    "Start": "2019-03-26T09:00:00Z",
    "End": "2019-03-26T10:00:00Z",
    "Period": {
        "Days": 1,
        "Hours": 7.5
    },
    "Expires": "2020-03-26T00:00:00Z"
}'

{
  "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": "Reason",
        "message": "Validation failed for a specific property",
        "details": [
          {
            "code": "YM1015",
            "reference": "https://developer.youmanage.co.uk/api/errors/ym1015",
            "target": "Reason",
            "message": "The value must be in the set of allowed values",
            "details": null
          }
        ]
      }
    ]
  }
}

  

Solution

Reissue the same request but ensure that the value is taken from the allowed set of values.