Correct way to stop a running stopwatch with REST API

I’m making a python script that shows todo list items in the ubuntu system try and starts and stops a aw-stopwatch timer for tasks.

I have created a running stopwatch event like this:'http://localhost:5600/api/0/buckets/aw-stopwatch/events', json={"data": {"running": True, "label":"My todo list item"} })

What is the simplest correct way to stop it later on when I’m done?

I have tried sending a similar request with: {“data”: {“running”: False} which does seem to stop the event but it starts another one with “no label” as the label.

Looking at the network activity from http://localhost:5600/#/stopwatch when I stop a stopwatch I see the request looks like this

         "label":"label for the task I'm trying to stop"

Is all of that data necessary to stop a running stopwatch?

Thanks for your help!

May I suggest to use TaskWarrior instead?

I made a simple hook to send a stopped task elapsed time to an ActivityWatch’s bucket, so, there is no need of a timer since the time is calulated as the difference of the started time and the stopped time. Here es my TaskWarrior Hook for the case:

Good suggestion. That is exactly what I ended up doing after trying several other things. I liked the option of starting a timer in the stopwatch view of the ActivityWatch and being able to watch the api for changes but I ended up scraping that feature.

I wanted something that would hook into my shared Vikunja and CalDav lists but I’m interested to check out task warrior!

It’s pretty cool, it’s opensource too and CLI, so it’s very simple, extensible and low resource consumer.