Support Topics Documentation Slack YouTube Blog

REST API Pagination - increase 100 record limit

Up until today I was on the free Springboard plan but I would like to use an API that brings back 262 records, so I have signed up to Cloud9 with the intention of paying to increase the 100 page size limit.
I was previously told this; You can buy additional 100 cache objects packs in our Marketplace (in App Management section). If you need 300 objects then you can buy 2 packs of 100 objects.
I am slightly confused now, as I am looking at a plan comparison table that is telling me the Cloud9 plan has 50 cached objects, compared to Springboard with 100…but I am still pulling through pageSize=100 right now, which makes me think I am about to purchase the wrong thing.
Can anyone help with the process of this? That is, what I purchase and do I then simply go into my API and increase my pageSize query parameter from 100 to 300 and whereas previously I got an error message when I did this, it will be OK and the Query Parameter will work?

I am a little lost on the terminology I think…

Thanks
Paul

Hello @Paul_McCullen,

100 cache objects packs

This function pack gives you an opportunity to store more objects in Backendless Cache but it does not increase max page size for data service. There is no function pack to increase max page size. To get all data you should just use the pagination aproach.

Regards,
Sergey

Hi Sergey

This is becoming tiresome…
This was my query to one of your sales team: In the short term, what I am after is simply the ability to pull through 300+ objects with an API rather than the normal limit of 100.
And his response: You can buy additional 100 cache objects packs in our Marketplace (in App Management section). If you need 300 objects then you can buy 2 packs of 100 objects.

When you say I ‘should just use the pagination approach’, what I want to do is pull ~260 records with one API into Appgyver. Can you outline how I would do this?

Thanks

@Paul_McCullen

First of all sorry for misunderstanding and inconveniences this might have caused.

To get all data you can create service that will find all data from the table, for example in codeless:

or in JS it will be the following code:

'use strict';

class /*SERVICE_NAME*/TestDateService/*SERVICE_NAME*/ {
/*TYPES*/
/*TYPES*/
/*METHODS*/
/*METHOD find*//*METHOD_COMPLEX_TYPES*//**//*METHOD_COMPLEX_TYPES*/

/**
* @route GET /find
*/
async find() {
/*METHOD_BODY*/
var list, offset, listPaging;

function addItemToList(l, v) { Array.prototype.push.apply(l, Array.isArray(v) ? v : [v]);return l;}


  list = (await Backendless.Data.of('MyNewTabe').find(Backendless.DataQueryBuilder.create().setPageSize(100)));
  listPaging = list;
  offset = 100;
  while (listPaging.length > 0) {
    listPaging = (await Backendless.Data.of('MyNewTabe').find(Backendless.DataQueryBuilder.create().setPageSize(100).setOffset(offset)));
    addItemToList(list, listPaging);
    offset = offset + 100;
  }

  return list

/*METHOD_BODY*/
}
/*METHODS*/
}

Backendless.ServerCode.addService(/*SERVICE_NAME*/TestDateService/*SERVICE_NAME*/);
1 Like

Hi Sergey
I followed the below document and have managed to get it working after I ‘invoke’ in ‘Business Logic’…all records come through.
But I am falling over at the last hurdle…I assumed I would be able to put the address into a GET collection API, but it is not pulling anything through. Can you detail what the format should be? This is the address and I thought I would add /tablename to it, but I am failing…perhaps I need the whereclause in there as well, but not 100% sure.

https://eu-api.backendless.com/---/services/YourServiceName/findOjbectsWithPaging

Thanks
Paul

Hi Paul,

I should be able to help you. Any chance you could attach a screenshot detailing where you need help? I feel like I need some additional context to understand that last hurdle.

Regards,
Mark

Hi Mark

This is where I have got to, and under ‘Response’ it pulls through everything from the ‘StandardSplits’ table…262 records…all good there.

My thought was to now take the address from ‘POST’, append the data table name (/StandardSplits) and the where clause (%objectId>99%), and put it in Appgyver (below)…which seems simple but I suspect I am missing something in the API in Appgyver. Is my logic sound?

I am not familiar with AppGyver, but by looking at the screenshot you provided, it appears you’re configuring a GET request, while your API service in Backendless is POST.

Also, the API service requires that AppGyver sends the following request in the body:

{
  "tableName":"StandardSplits",
  "whereClause":"objectId > 99"
}

It is imperative that the body is formatted exactly as shown in Backendless console. Also, it is very important that the request also has the following HTTP request header:

Content-Type: application/json

Hope this helps.

Regards,
Mark

Thanks Mark. That helps…the doc I was following left the POST/GET field blank, and it must default to POST. I will do it again.

Thanks again
Paul

HI Mark

Works fine as GET.
To your last two points above, by default Appgyver sends request as Content-Type: application/json, so that was not a problem. And all I needed to get the address to work was /findObjectsWithPaging?tableName=PaulTable where I was doing /findObjectsWithPaging/PaulTable

Thanks again

1 Like

Man, you’re a real MVP in this game.
Thank you!