<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hello. </div><div><br></div><div>I am using the api to retrieve information about downloads, and compare usage of my institution datasets from year to year.</div><div><span style="line-height:1.5">I use the last option in </span><a href="https://www.gbif.org/developer/occurrence#download" target="_blank" style="line-height:1.5">occurrence downloads</a><span style="line-height:1.5"> section, which lists the downloads activity of a certain dataset: </span><br></div><div>/occurrence/download/dataset/{datasetKey}</div><div><br></div><div><div>I have a couple of questions (a bug and a request)</div><div></div></div><div><br></div><div>(1)  BUG:</div><div><span style="line-height:1.5">For one of our datasets, I was delaying a few seconds between page requests until I got this error at a certain offset:</span></div></div><div dir="ltr"><div><br></div><div><a href="http://api.gbif.org/v1/occurrence/download/dataset/1c334170-7ed1-11df-8c4a-0800200c9a66?limit=100&offset=40250">http://api.gbif.org/v1/occurrence/download/dataset/1c334170-7ed1-11df-8c4a-0800200c9a66?limit=100&offset=40250</a></div><div><br></div><div>Oddly, if I increased or decreased the offset a little bit, I got no errors.</div><div>So it seemed to me a problem related to a certain download event record.</div><div></div><div><br></div><div>Then I changed the offset and limit and I was able to find the single event using this url: </div><div><a href="http://api.gbif.org/v1/occurrence/download/dataset/1c334170-7ed1-11df-8c4a-0800200c9a66?limit=1&offset=40325">http://api.gbif.org/v1/occurrence/download/dataset/1c334170-7ed1-11df-8c4a-0800200c9a66?limit=1&offset=40325</a><br></div><div><br></div><div>This download event was on 2016-03-01 (date reported in the events after and before that offset). </div><div>Unfortunately, when you read this message the number of download events will already be higher. So you will need to change the above url and increase the offset value to see the same event record (because the api offset count begins with the last download event instead of beginning with the first one). </div><div>I created this copy of the error page for you: <a href="http://archive.is/5UNAy">http://archive.is/5UNAy</a></div><div><br></div><div>Or you can substract the current number of downloads count minus <span style="font-family:Arial;font-size:10pt;text-align:right;line-height:1.5">18918 to find the offset for the problematic record.</span></div><div><br></div><div>(2)  ENHANCEMENT:</div><div><span style="line-height:1.5">I take the opportunity to encourage you to introduce a "sort" parameter in this kind of api requests. So that limit=1&offset=0&sort=asc will return the oldest event (instead of the newest one). You can keep the current sorting as default (i.e. sort=desc) so you don't break any applications which are already using this api.</span></div><div><br></div><div>This option will make the above url more permanent (so you keep getting the same event records when you repeat the same offset/limit values using sort=asc).</div><div><br></div><div>It would be much easier to track historical usage of datasets: if I store the offset of my last report, I can resume it from that point the next time I want to see activity of this dataset (i.e., if year 2018 events begin at offset 3333 and end at 3567, I will be able to make my next report starting at offset 3568)</div><div><br></div><div>Another option would be to let use filter events by date (BTW, the api shows a "created" and a "modified" date, but I don't understand the meaning of "modified" for a download event).</div><div><br></div><div><span style="line-height:1.5">Thanks a lot in advance for your help</span><br></div><div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div>David </div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div>