How to limit the API result ??

27 views
Skip to first unread message

Dumitru Gutu

unread,
Jan 23, 2020, 1:41:35 PM1/23/20
to TramsAPI Beta
Does I can limit the result of API by pages and count the record on page. Let say give me first page with 100 records on the page. When I'm doing the following call I get 

{
    "apiVersion": "4.08",
    "result": {
        "resultcode": 99,
        "resulttext": "ChildDatasetToJSONData Error: Result too large. Rows so far=120000, size so far=290807259"
    }
}

POST /invoicequery/runquery HTTP/1.1
Content-Type: application/json
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: 43f03596-b1eb-442c-9af1-5b66b6f7f871,a8d0bf87-4ba0-4279-8888-fb8bb142e97b
Accept-Encoding: gzip, deflate
Content-Length: 61
Connection: keep-alive
cache-control: no-cache

{
  "SessionID": "{C4A8DC21-5ECE-4602-9C3D-80389384BB6B}"
}

Dan Palley

unread,
Jan 23, 2020, 3:04:48 PM1/23/20
to TramsAPI Beta
Hi Dumitro

There are parameters to limit the number of rows returned.

I will try to post an example later today.

You can also specify filters to limit the result set.

Dan

Dumitru Gutu

unread,
Jan 24, 2020, 9:35:23 AM1/24/20
to TramsAPI Beta
Hi Dan, was you able to find some time and provide and example on how to query API with page and limit parameters ?

Dumitru Gutu

unread,
Jan 24, 2020, 9:39:02 AM1/24/20
to TramsAPI Beta
Finally I'll need create that will query the API to pull all data by pages and insert some of the data into one database. So I need cycle all pages starting first one and go one by one till the end. How I can accomplish that ? Could you please assist ?

Dan Palley

unread,
Jan 24, 2020, 12:17:56 PM1/24/20
to TramsAPI Beta
Hi Dumitru,

There are two ways to limit the number of results returned. 

First is using TopRows, which simply returns the first x rows of the result:

{
  "params":  {
  "topRows":25
  }
}

The second method is more flexible and has two parameters: StartingRow and RowCount.  This would be more useful for pagination.  Unfortunately, it appears to be broken at the moment as it's dependent on the underlying capabilities of the database server.  Interbase has a ROWS parameter in recent versions, but older versions did not.  We can try to address in a future update.

Dumitru, how many rows are you looking to present to the user?  The current limit is around one hundred thousand results.  Do you really need to present more results than that?

Dan

Dumitru Gutu

unread,
Jan 25, 2020, 12:12:16 PM1/25/20
to TramsAPI Beta
Hi Dan, that work for me. I'll continue explore the API and after will present to the client. I'm not sure how much they want us to pull over API. BWT - I'll let them know bout the limitation of "one hundred thousand results"
Reply all
Reply to author
Forward
0 new messages