Quantcast
Viewing all articles
Browse latest Browse all 3694

How to change a Todoist task's duration with the update_task Python and REST API?

I've tried Todoist APIs' update_task and I get error code 400:

"Client Error: bad request for url https://api.todoist.com/rest/v2/tasks/[...]" with

# Define the task ID and the new durationtask_id = "0123456789"new_duration = {"amount": 30,"unit": "minute"}# Update the task's durationapi.update_task(task_id=task_id, duration=new_duration)

and

payload = {"duration": {"amount": 30,"unit": "minute"    }}response = requests.post(f"{TODOIST_API_URL}/{task_id}", headers=headers, json=payload)

What is the correct way of using the duration args? Or is the problem somewhere else?

The "content" of the task does update successfully. The task is set in the future and I also tried setting duration as null and valid from the Todoist app before calling the API but I get the same error.


Viewing all articles
Browse latest Browse all 3694

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>