REST API GetCollection payload

In order to get the list of objects we need set the path to the response data. But how do I retrieve the count value from the payload as well ? Thx; Piotr
{
“count”: 2408,
“results”: [
{

Finally, I opted for having a pre-call to the API at the app launch (in the global canvas page) via HTTP request. Merely to retrieve the count of records (albeit against hardcoded selection criteria). Still I would have preferred to be able to access any data in the GetCollection json payload. That is of course the case if I remove the Response key path but then the status of the GetCollection call will be an error:

you mean the number of results?
if yes, you can use the formula COUNT to get the number of items in a list wherever you need to use that number

Thx @Dimos_Vamvourellis for the hint; The external API that I have got returns a global number of records based on a page size that I need to define upfront (or use a default value of one hundred records per page). Let’s say I set page size to 20 records; (So In my case I know in advance the count of records per page - and that what COUNT would have returned).
The API will return the total count of records (2412 in this case). Then I need to do CEIL(2412 / 20) = 121 to obtain the total number of pages based on the initial selection criteria. And I need to know the total of pages to set the max limit of for instance my scrollbar etc. The workaround I described above works for now but I would expect GetCollection would allow for some flexibility when it comes to json payload data parsing. @Mevi , any ideas ?

ohh, i see, try making a test call in postman to see if the problem is from appgyver

there is no problem; it is just GetCollection is likely restricted to return arrays of records…not sure thus my question; Please let Appgyver Team comment on this; I hope that helps

Hmm… I don’t think there’s a smooth way to get this via the REST API Get Collection, but if you use a direct HTTP Request to do the get, you could use both the count and the results if you’d prefer that?

Thanks @Mevi , this is what I have figured out. So I implemented this logic using HTTP request every time the fetch criteria change including at the app launch. However I retained the built-in GetCollection to fetch the json array from the payload in all visible pages. This means that once in a while, when the selection criteria change, my app will fetch the data twice…OK-ish for now; Having said that, going forward, I may simply create myGetCollection logic implemented with HTTP request…not sure whether this would be the best practice recommended by Appgyver though ?

1 Like

Hmm, you could experiment with creating a new flow function from the http request to include the information you’d like? You can find this button when you select the flow function(s) and click on the left-most icon in the bottom of properties bar:
Screenshot 2022-05-06 at 14.37.43

Hi @Mevi , Eventually this is what I had done. However my thinking and approach is for sustainability, maintainability reasons to rely on built-in functionalities of a given product as much as possible. But for the time being it is good enough; Thanks; Piotr