Forums

Pause and restart always on task with the API

Hello,

Is there a way to pause and restart an always on task using the API? If yes, what is the endpoint and what is the format of what needs to be sent?

Thanks!

There is a restart endpoint: https://help.pythonanywhere.com/pages/API/#always_on

There is an example request at the beginning of the help page which shows the format you could use.

Right, but what would my API request look like with me including the parameters?

Also, I don't see how to pause it.

Send a PATCH request to the task with "enabled": false

That gives me an error: Traceback (most recent call last): File "/home/Kovy/EY/api_test.py", line 10, in <module> json={'enabled':false}, NameError: name 'false' is not defined

And when I do it with the quotes I get: Got unexpected status code 403: b'{"detail":"You have reached your always on task limit."}'

Which is true, but I'm just trying to pause it.

Sorry, it looks like there was a typo in @glenn's message above -- in Python code you should use False rather than false.