Hi,
Using the API explorer "post /api/v2/taskmanagement/workitems":
I'm able to add workitems correctly, but not with "customFields object" or custom field as defined in worktype schema.
Whatever we put in, we always receive
{
"message": "Invalid JSON schema instance. Details: {'Key Name': 'value'} is not of type 'string'",
"code": "schema.error.invalid.instance",
"status": 422,
"messageWithParams": "Invalid JSON schema instance. Details: {details}",
"messageParams": {
"details": "{'Key Name': 'value'} is not of type 'string'"
},
"contextId": "283c2535-0bb9-404e-8362-544cd7b214cf",
"details": [],
"errors": []
}
Hoe should we define the "Object Properties" correctly?
I didn't try it myself but I understand you must first create a schema which contains the custom attribute names you may use for these worktype/workitems (I would recommend not to use attribute name with spaces in it like 'Key Name' - you can define a proper sentence using title or description fields).
You then create a worktype with a reference to the schema you have created (schemaId).
And finally, you can start creating workitems, referencing the worktype you have created (typeId) and containing the custom attributes, whom names have been defined in the schema (in first step).
Mostly this is if you use API Explorer in the normal mode. If you switch it to ProMode and copy and paste the JSON you want to submit, this will work. In normal mode, the layout of the custom fields is not correct. I include a sample JSON to help