Closed davidorme closed 2 years ago
OK - I have just spotted that I used client.tasks.update
not client.tasks.update_task
. The current code in master in tasks.py
suggests .update
, but the API docs have .update_task
. Both seem to do something, but neither updates.
In [150]: response = client.tasks.update_task(this_dependent['gid'],
...: {'data': {'start_on': '2021-11-25', 'due_on': '2021-12-08'}})
...: print(response['start_on'])
...: print(response['due_on'])
...:
2021-12-04
2021-12-08
CURL works. I'm wondering if it is the quotes?
curl -X PUT https://app.asana.com/api/1.0/tasks/<redacted> \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <redacted> \
-d '{"data": {"start_on": "2021-11-25", "due_on": "2021-12-08"}}'
OK - nope. It is wrapping the body in {'data': {}}
that is the issue. My mistake
In [160]: response = client.tasks.update(this_dependent['gid'],
...: params= {"start_on": "2021-11-25", "due_on": "2021-12-08"})
...: print(response['start_on'])
...: print(response['due_on'])
...:
2021-11-25
2021-12-08
Hi,
We're looking at moving to Asana and using some python scripts to implement some custom behaviour (like pulling start dates forward when dependencies are completed - this works using Rules via the web app but reduces the dependent duration to a single day). The problem I'm having is that I can't seem to move start dates - I've seen the note in the API docs about needing to provide
start_on
anddue_on
, but it doesn't seem to work. The call goes through, but the returned data for the updated task has an unchangedstart_on
value.Any suggestions?