Invalid Date

Dates must be in the correct format

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

Summary

If you receive this error code then you have supplied a date value that is in an invalid format.

curl -X PUT -H "Authorization: ApiKey {ApiKey}" \ 
  -H "Content-Type: application/json" \
  --data "{\"Started\": \"InvalidDate\"}" \
  https://api.youmanage.co.uk/employees/7

{
  "error": {
    "code": "YM1000",
    "reference": "https://developer.youmanage.co.uk/api/errors/ym1000",
    "target": "Validation",
    "message": "Validation failed",
    "details": [
      {
        "code": "YM1005",
        "reference": "https://developer.youmanage.co.uk/api/errors/ym1005",
        "target": "Started",
        "message": "Dates must be in the format 'yyyy'-'MM'-'dd'T'HH':'mm':'ssZ'",
        "details": null
      }
    ]
  }
}

  

Solution

Simply reissue the same request but ensure the date follows the required ISO 8601 format.

curl -X PUT -H "Authorization: ApiKey {ApiKey}" \
  -H "Content-Type: application/json" \
  --data "{\"Started\": \"2019-08-03T12:34:56Z\"}" \
  https://api.youmanage.co.uk/employees/7

HTTP/1.1 204 No Content