Hi Jan,
If you need to get only number of connections then you can modify API request as following:
/v3/data/HistoricalClientCounts.json?id=gt(target)&.maxResults=1
This query will return only one entity without any details. Response will contain total number of connections as "@count" attribute of "queryResponse" object:
{"queryResponse":{"@last":0,"@first":0,"@count":2853,"@type":"HistoricalClientCounts","@requestUrl":"https://pi/webacs/api/v3/data/HistoricalClientCounts?id=gt(1)&.maxResults=1","@responseType":"listEntityIds","@rootUrl":"https://pi/webacs/api/v3/data","entityId":[{"@type":"HistoricalClientCounts","@url":"https://pi/webacs/api/v3/data/HistoricalClientCounts/1451250","$":"1451250"}]}}
It is not possible to obtain # of connections for past/week month as this data is stored in database only for 24 hrs. After that it is completely removed.
I wonder how many clients and connections per day? It is expected that this API should not take 3-4 hrs to return data. What is your PI version?