Error 500 when requesting acc.xyz from api

Subject of the issue

Error 500 from server during data pull from logbook/storage/ and data type “acc.xyz”, page_hits=200, page_num = 2

for page_num = 1 I’m able to download the results as shown below.

for obd.rpm and track.pos works fine.

Your environment

  • Python 3.7 with anaconda on eclipse 2019-09 R

Steps to reproduce

  1. Setup the http get request.
  1. params={"page_hits": 200, page_num : 2, "device_id": "DEVICE ID HERE", "data_type": "acc.xyz", "start_utc" : 2020-01-03T08:00:00, "end_utc": 2020-01-03T19:00:00}
  1. URL = "https://api.autopi.io/logbook/storage/raw/
  1. headers = {"Connection": "keep-alive","Content-Type": "application/json", "Accept": "application/json", "Authorization":"bearer %s" %self.token}
  1. Run the program.
  1. import requests as _
  1. response = _.get(URL,params = params, headers = headers)
  1. print(response.text)

Expected behavior

No error and a response similar to these from page_num:1

{"count":19790,"results":[{"data":{"y":-0.03,"x":-0.03,"z":0.98},"ts":"2020-01-03T13:53:21.826237Z"},{"data":{"y":-0.04,"x":-0.04,"z":0.98},"ts":"2020-01-03T13:53:21.147826Z"},{"data":{"y":-0.04,"x":-0.04,"z":0.97},"ts":"2020-01-03T13:53:20.515250Z"},....

Actual behaviour

<h1>Server Error (500)</h1>

Hi Varnavas

You get an error because the amount of data returned in the search is too large.
Basically the total resultset must not reach or exceed 10000 elements, and if you set the page size to 5000, and set the page to 2, then you reach that limit on page 2.

So the solution is to lower the page size, and or change the from/to parameters to get fewer results.

I have added a task to improve the error messages returned if this situation occurs.

Best regards
/Malte