Cancel
Showing results for 
Search instead for 
Did you mean: 

MDSP iottimeseries difference of the HTTP GET request times

Experimenter
Experimenter

I am trying to understand how iottimeseries API behaves, I am doing a request like below 

/api/iottimeseries/v3/timeseries/{assetId}/{aspectname}?from=&to=2019-07-10T07:11:04.312Z&limit=1&sort=desc , but I dont know sometimes this request can take up to 28 seconds. 

Is it because I am not provide a from request parameter? But sometimes it only takes 1 seconds or below, can somebody please explaing this?

 

2 REPLIES 2
Highlighted

Re: MDSP iottimeseries difference of the HTTP GET request times

Experimenter
Experimenter

/api/iottimeseries/v3/timeseries/{assetId}/{aspectname}?from=&to=2019-07-10T07:11:04.312Z&limit=1&sort=desc , but I dont know sometimes this request can take up to 28 seconds. 

well it has to sort all records first, before returning you the top most record only.. depending on "how much" it has to sort, the request takes longer/less time to finish..

 

regardless, if you just want to fetch the very last data point (i.e. the most recent one), you can simply write 

/api/iottimeseries/v3/timeseries/{assetId}/{aspectname}

without from/to/limit https://developer.mindsphere.io/apis/iot-iottimeseries/api-iottimeseries-samples.html#get-the-latest...

 

or

 /api/iottimeseries/v3/timeseries/{assetId}/{aspectName}?latestValue=true

to get the most recent record for each variable https://developer.mindsphere.io/apis/iot-iottimeseries/api-iottimeseries-samples.html#get-the-latest...

 

HTH

Re: MDSP iottimeseries difference of the HTTP GET request times

Experimenter
Experimenter

Yes you are correct. But in our case we dont need the latest timeseries but only the last timeseries before a date. We found it better to define also 'from' paramater in the request. 

/api/iottimeseries/v3/timeseries/{assetId}/{aspectname}?from=2019-07-9T07:11:04.312Z&to=2019-07-10T07:11:04.312Z&limit=1&sort=desc