501 error - must not be blank - task status

Hi,

when I try change task status by api I receive error message:

{"message":"must not be blank","code":501}

I’m using python to connect and this is how my code look:

import csv
import json
import requests

token = "token"
url = "https://api.clockify.me/api/v1/"
project_id = "id"
headers = {
   "X-Api-Key": token
}

data = {
    'status': 'DONE',
}

response = requests.put(
    f'{url}/workspaces/workspaceid/projects/{project_id}/tasks/taskid', 
    json=data, 
    headers=headers
)

print(response.text)

What I do wrong?

  • when I add more parameters e.g. ‘name’, request start working

Hello Mariusz,

Yes, even if you only want to update the task’s status, you must include all of the parameters in the body of the request because when you send a PUT request, the entity that you’re sending will overwrite the current one.
This is the expected behavior because the endpoint ends with task ID. If it were a PATCH method, you would be able to change one parameter only, or if the endpoint ends in ‘status’ instead of the task ID.

I hope this clarifies it a bit!

Cheers!

1 Like