# Is it possible to download datapoints since specified time for a single goal through the API?

**URL:** <https://forum.beeminder.com/t/is-it-possible-to-download-datapoints-since-specified-time-for-a-single-goal-through-the-api/2105>\
**Category:** Tech\
**Created:** [April 13, 2016, 4:56am UTC](https://forum.beeminder.com/t/is-it-possible-to-download-datapoints-since-specified-time-for-a-single-goal-through-the-api/2105 "2016-04-13T04:56:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbork](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@mbork](https://forum.beeminder.com/u/mbork)\
**Post date:** [April 13, 2016, 4:56am UTC](https://forum.beeminder.com/t/is-it-possible-to-download-datapoints-since-specified-time-for-a-single-goal-through-the-api/2105/1 "2016-04-13T04:56:19Z")

</div>

I can download all datapoints for a goal, or datapoints dince some time for all goals. But what about marrying these two options?

---

<div class="post-metadata">

**Author:** ![philip](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/philip/32/1505_2.png) [@philip](https://forum.beeminder.com/u/philip)\
**Post date:** [April 13, 2016, 8:04am UTC](https://forum.beeminder.com/t/is-it-possible-to-download-datapoints-since-specified-time-for-a-single-goal-through-the-api/2105/2 "2016-04-13T08:04:40Z")

</div>

Yes, indirectly, but it’s a hack because the datapoints endpoint doesn’t appear to support either `diff_since` or `datapoints_count`.

Workaround is to fetch the goal object with the datapoint constraints, and then return the datapoints instead of the goal…

Here, have some perl from my `beemapi.pl`:

```
# bizarre implementation because datapoints.json doesn't respect diff_since
sub beemfetchsince {
  my ( $u, $g, $t ) = @_;

  my $ua = LWP::UserAgent->new;
  my $uri = $beembase .
        "users/$u/goals/$g.json?auth_token=$beemauth&diff_since=$t&datapoints=true";

  my $resp = $ua->get($uri);
  beemerr('GET', $uri, {}, $resp);
  my $results = decode_json($resp->content);

  return $results->{datapoints};
}
```

---

<div class="post-metadata">

**Author:** ![mbork](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@mbork](https://forum.beeminder.com/u/mbork)\
**Post date:** [April 18, 2016, 7:27am UTC](https://forum.beeminder.com/t/is-it-possible-to-download-datapoints-since-specified-time-for-a-single-goal-through-the-api/2105/3 "2016-04-18T07:27:26Z")

</div>

Thanks, it worked! See [https://github.com/mbork/beeminder.el/commit/d5a0ec82c879ed70d38825f8ce62bc3f93ba8821](https://github.com/mbork/beeminder.el/commit/d5a0ec82c879ed70d38825f8ce62bc3f93ba8821)
