Current red line value from goal API?

Is it possible to get the current value of the red derailment line for today from the API?

I’ve looked through: Beeminder API Reference

And the best I see was to calculate it from curval + delta but that will depend on the curval every time there is a new datapoint for the day.

I have calculated it from the road values in the past, but that is a lot of date math I should not need to be doing for a “simple” query like this.

Am I blind? Is there a better way?

I’m going to throw my hat in the ring for “if there isn’t, there should be”, along with “what is a day’s value”.

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