Skip to content

OpenAPI - paging iteration updade request - page limit & cursor #56

@rduyme

Description

@rduyme

Bug report Alexios

In the specs, it mentions the field "last page". I don't think this is a good idea to show to the user the last page.

Image

Let me explain why:

In our Prod env, the total_product items is: 217_257_614
default page size is 10, but even if it's 50:
50 items/page → ~4_345_152 pages

If set page to this big number, this will cost in performance. Our search engine (Solr) will need to go all the way down in the index until it reaches this result set. On our Beta env, Solr went out of memory and crashed. So technically, this is not a good idea. For the user's point of view, this is also not very practical - it doesn't make sense to request such a big page. Just adjust the filters to get more accurate result.

For OpenAIRE APIs, we apply a limit for pagination with offset - up to 10000 results
If the user wants to get a bigger dataset, then cursor pagination should be used.
https://graph.openaire.eu/docs/next/apis/graph-api/searching-entities/sorting-and-paging#paging

So, I will remove the "last page" from the response (it is optional, right?) and will apply a validation on page max number.
If the user exceeds this limit, an error like this one will be thrown:

{
"message": "Page * pageSize must be less than or equal to 10000",
"error": "Bad Request",
"code": 400,
"timestamp": "2026-04-21T21:38:22.487+00:00",
"path": "/graph/v2/researchProducts?page=10000&pageSize=10&sortBy=relevance%20DESC"
}

I suggest to remove it from SKG-IF spec, also. And describe a cursor pagination, for the case when a big dataset is required by the user.

Regards,
Alexios

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions