API Deadline

Hey Everyone,

I looked through the API docs and I did not see a way to update a goal’s deadline. Does anyone happen to know how to do it (e.g. add deadline param to PUT)?

2 Likes

It’s not specifically mentioned in the API docs for updating a goal, but most (all?) of the values described on the overall Goal Resource[apidoc] page are accepted by update requests, deadline being one of them:

╭─(robertp)───(awscmh3)───(~)
╰──╼ curl -sSL 'beeminder.com/api/v1/users/me/goals/coding.json?auth_token=[snip]' | jq '.deadline'
0
╭─(robertp)───(awscmh3)───(~)
╰──╼ curl -sSL -XPUT 'beeminder.com/api/v1/users/me/goals/coding.json' -d auth_token=[snip] -d deadline=3600 | jq .deadline
3600
╭─(robertp)───(awscmh3)───(~)
╰──╼ curl -sSL 'beeminder.com/api/v1/users/me/goals/coding.json?auth_token=[snip]' | jq '.deadline'
3600

(and I confirmed on the goal page in-browser that it actually did work, too!)

3 Likes

Nifty, thank you! I got it to work. I did not know that the params in Goal Resource are widely accessible for updating goals.

2 Likes

@dreev, it might be worth putting a blurb on the “update” api pages that explicitly only calls out what (if any) attributes can’t be updated and says that the rest can—right now there’s a list of the “special” ones like roadall, but it also includes a few “normal” parameters (like title) that make it look like ones not mentioned (like deadline) can’t be updated.

Also, lol, at first I thought I’d found a bug here, but actually it was just that I had genuinely forgotten to update this goal’s deadline, which I randomly selected as an example, when y’all introduced adjustable deadlines for toggl goals! :smiley:

2 Likes