Does (/can) the API support If-Modified-Since headers? How about webhooks?

[pasted from an email to Danny, who suggested I post here and tag @bee ]

<context>
I just did a 7.5-day maniac week on Complice, and it was awesome.

I was hoping to get offline-sync implemented in the first few days and then build an android app, but… it totally took me the full week just to get syncing mostly working. Still a few days of work left to go.

Anyway, soon I will have a totally badass system that syncs between the app, browser storage, and backend. So the app never needs to say “saving” or whatever because it’s always saved instantly, and you can keep using it offline, even for (I think; haven’t tested it yet) several days in a row!

And the system is modular and robust and easy to plug new components into :smiley:
</context>

Related to this syncing work, it would be super awesome for me if the Beeminder API were able to:

  • handle If-Modified-Since headers with 304 Not Modified responses, so that I don’t need to fetch a whole bunch of data if nothing has changed
  • send the Complice server a webhook when goals do change, so I could automatically fetch new data and tell the frontend about it

I think the If-Modified-Since is probably pretty easy to implement… maybe you already have it and I just haven’t checked? But if so, it would be good to add it to the API docs.

1 Like

We don’t handle if-modified-since headers unless it’s out of the box magic with rails, which I’m guessing it’s not. We do have the diff-since flag on the user object, which will return only datapoints & goals that have been modified since the given timestamp. So that’s along the lines of what you’re looking for. – http://api.beeminder.com/#getuser

We’ve got per-goal webhooks that’ll fire whenever a datapoint is added or modified, but that’s specific to datapoints, and doesn’t give you info about other changes to user or goal. Also it’s more of a user-field, as in a thing that we give to users UI access to, rather than an api thing. Meaning it’s not technically an api field and settable/getable through the api, and there’s only one per goal, so not something meant for an api client to get and set.

2 Likes