Creating Tasks via API
Hey,
Im trying to create task from the API (https://twenty.com/developers/rest-api/core#/operations/createOneTask)
Body that im sending: "{
"position": 1,
"title": "test",
"body": "test body",
"dueAt": "2019-08-24T14:15:22Z",
"status": "TODO",
"createdBy": {
"source": "API"
},
"assigneeId": "d6e2b518-adf6-4f15-b5a0-163317af4980"
}"
Getting response 201 without errors, but when i enter the Tasks tab it gets always "SyntaxError: Unexpected token T in JSON at position 0
2024-11-18T10:40:25.803777508Z at JSON.parse (<anonymous>)
2024-11-18T10:40:25.803786738Z at ActivityQueryResultGetterHandler.handle (/app/packages/twenty-server/dist/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/handlers/activity-query-result-getter.handler.js:16:27)"
Version: 0.32.4
Self-Hosted, but checked 5 mins ago and having the same problem.
Do you have any ideas where is the problem?
Twenty.com
Open Source CRM
2 Replies
Hey @Pawel | #DRIVE! Field body is not of type TEXT but RICH_TEXT. It's a json. If you want to edit that field, you simply need to create the task without it and then edit the note field on show page (screeshot).
If you need to do it through API, just do a test through web and then follow the same json format for your next API calls.
TYI we plan on allowing RICH_TEXT fields to be written as simple text in near futur. But for now this is still required to follow the right json format