Error updating tasks when i can create a new task fine

i am sending this exact same data stream to:

  • PUT tasks/1190895517233606 (to update task gid=1190895517233606 which definitely exists)
    and to
  • PUT tasks (to create a new task)

{ “data”: {“completed”: false,“assignee” : “1183597112141633”,“due_on”: “2020-09-03”,“name”: “\u26a0\ufe0f SHEPHERDS LODGE”,“notes”: “Bath Rugs - 6\Kitchen Towels - 8\DW Tablets\Kitchen Trash Bags - 33 Gallon\Small Trash Bags - 6\Coffee\\\”,“projects”: [ “1190420945734503”],“memberships”: [ {“project”: “1190420945734503”,“section”: “1190686527776922” }], “external”: [{ “data”: “5163”, “gid”: “rez_id”}],“custom_fields”: {“1190426827250580”: “09/03/2020”,“1190234828060642”: “13”,“1183598215899870”: “1183598215899871”,“1185199971905319”: “1298”,“1190426827915555”: “5163”,“1190426828049766”: “1190901585675969”},“resource_subtype”: “default_task” }}

the create works, the update returns: [message] => No matching route for request it’s as if that task id is not correct… but this works:

GET task/1190895517233606

returns the task.

ok, one update, but still an issue. i was using POST for both update and new. looks like you have to use PUT with the update. so i changed that and it still doesn’t work but the error is:
Could not parse request data, invalid JSON.
even though the JSON is the same with both the POST tasks and the PUT tasks/1190895517233606

The problem in the Update is here:

projects can only be specified at task creation time. Its description in the API docs:

Create-only. Array of projects this task is associated with. At task creation time, this array can be used to add the task to many projects at once. After task creation, these associations can be modified using the addProject and removeProject endpoints.


EDIT:

Actually you’re going to have the same issue with memberships as well:

Create-only . Array of projects this task is associated with and the section it is in. At task creation time, this array can be used to add the task to specific sections. After task creation, these associations can be modified using the addProject and removeProject endpoints. Note that over time, more types of memberships may be added to this property.

2 Likes

i had tried that before and it still doesn’t work without projects and memberships removed. i also tried removing ‘external’ in addition and notes (since it has some formatting in it), but everything give an invalid json error.

still get the same error. here’s the boiled down data.
PUT with data=
“{ “data”: {“completed”: false,“assignee” : “1183597112141633”,“due_on”: “2020-08-27”,“name”: “\u26a0\ufe0f SHEPHERDS LODGE”,“notes”: “Bath Rugs - 6\Kitchen Towels - 8\DW Tablets\Kitchen Trash Bags - 33 Gallon\Small Trash Bags - 6\Coffee\\\”,“custom_fields”: {“1190426827250580”: “08/27/2020”,“1190234828060642”: “1”,“1183598215899870”: “1183598215899871”,“1185199971905319”: “1298”,“1190426827915555”: “5188”,“1190426828049766”: “1190901585675969”},“resource_subtype”: “default_task” }}”

to url tasks/1190907109629661

and on not being able to update task memberships, looks like i would have to move it with POST /sections/{section_gid}/addTask instead of updating membership/section.

i think i sorted it out. i have to sent a PUT, but also (in php) have to not format the output like an http query which is the default.

having done that, i get the much better error message the i can’t write memberships. so you’re right about that, but i wasn’t getting that far even.

thanks for helping me noodle on it.

1 Like