Current red line value from goal API?

I think the (deprecated) baremintotal field contains the information you want, but unfortunately it’s a string (intended for display), not a number. If you really wanted to use it for this you’d have to parse it, taking into account that for timey goals it’s in hour:minute format. (Also, it’s generally a bad idea to build something new that depends on a deprecated field, and all that.)

I agree with @adamwolf that a non-deprecated version of this (as a number, without the need for reverse-engineering) would make a very good addition to the API.

As for “what is a day’s value” (which also would make a very good addition to the API), at least for now Altbee has an API for calculating this. (I’ve previously described it here.)

It works something like this:

curl -s \
  https://www.beeminder.com/api/v1/users/me/goals/$GOAL.json?auth_token=$AUTH_TOKEN\&datapoints=true |
  curl https://altbee.aeonc.com/api/bagg \
    -H 'Content-Type: application/json' --data @-

That is, just send to https://altbee.aeonc.com/api/bagg a POST with the results from the Beeminder goal API (with datapoints=true), and you’ll get back the same object with an additional field with the aggregated values for each day.

2 Likes