Task creation endpoint. Why can't typeOfWorkId, taskStatusId and entityId not be null or completely omitted?

According to the documentation of the task creation endpoint typeOfWorkId, taskStatusId and entityId can be null and are optional. Why when I then try to send a request with them either completely omitted or set to null I get the following validation error?

[{"property":"TaskStatusId","message":"'Task Status Id' must not be empty."},{"property":"TypeOfWorkId","message":"'Type Of Work Id' must not be empty."},{"property":"EntityId","message":"'Entity Id' must not be empty."}]

Am I misunderstand something here or is the documentation not correct?

Hi @Alexander7 , thanks for bringing this up. The documentation is auto-generated and not all properties that are required, specially on older entities, are always marked as required in the docs. Sometimes, they are required only in some cases and we don’t have a way to clearly show this in the docs. The API response in this case is correct though, as these properties are required. To create a project task, you need to provide the project id (entityId), status id and type of work id.

I will see if we can improve the docs here.

Thanks, Sebastian

Thanks for the quick response. Makes sense that it is hard to convey all the different cases while keeping the documentation clean and decently sized.

Hey @Alexander7 , we have now made the typeOfWorkId and taskStatusId optional. They will take default values if none are provided. The typeOfWorkId will be the first one created in the workspace and taskStatusId will be the first task status of type “to do”.

The entityId still is required.