Value is Auto Generated

You shouldn't supply a value for this property

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

Summary

This error occurs when you are creating an entity and have supplied a value for a property that is set to auto-generate.

An example of this is when you are attempting to create a new Employee entity and you have supplied a value for the EmployeeNumber property but your system administrator has enabled auto-generation for employee numbers. If this is the case then the API will reject the request.

curl -X POST \
  https://localhost:44336/Employees \
  -H 'Authorization: ApiKey {ApiKey}' \
  -H 'Content-Type: application/json' \
  --data '{
	"Title": "Mr",
	"FirstName": "Test",
	"LastName": "Employee",
	"Type": "Full-Type",
	"Company": "Awesome Inc.",
	"Manager": 666,
	"Started": "2018-01-01T00:00:00Z",
	"Division": "Test",
	"EmployeeNumber": "IT0002",
	"JobLevel": "Employee",
	"JobTitle": "Software Enineer",
	"Location": "n/a",
	"Department": "n/a",
	"WorkingPattern": 1,
	"EntitlementProfile": 1,
	"Status": "Current"
}'

{
  "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": "EmployeeNumber",
        "message": "Validation failed for a specific property",
        "details": [
          {
            "code": "YM1011",
            "reference": "https://developer.youmanage.co.uk/api/errors/ym1011",
            "target": "EmployeeNumber",
            "message": "A value was supplied but this property is set to auto generate",
            "details": null
          }
        ]
      }
    ]
  }
}

  

Solution

You can either reissue the request but without the data for that property, or you can get in touch with your system administrator to disable the automatic generation of that property.