Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

How do I implement a persisted GraphQL Paginated query that has Int parameters?

Avatar

Level 2

I currently have a persisted endpoint that is meant to allow for paging over a list of content fragments: 

 

/graphql/execute.json/xxx/getSomeContentFragmentPaginated;startRecord=0;numberOfRecords=3

 

 

The underlying GraphQL query looks something like this:

 

query getSomeContentFragmentPaginated($startRecord: Int, $numberOfRecords: Int)
{
     someContentFragmentList(offset: $startRecord, limit: $numberOfRecords) {
          items {
          ...

          }

     }

}

 

From the GraphQL Editor the query is ok - but when accessing it from the rest endpoint I get a casting error:

 

Variable 'startRecord' has an invalid value: Expected a value that can be converted to type 'Int' but it was a 'String' 

 

Any idea how I convert the incoming String value from the url to Int?

1 Accepted Solution

Avatar

Correct answer by
Level 2

This is a known issue apparently:

 

" SITES-15622: GraphQL - Issue with persisted queries with number & boolean parameters "

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @ArnoFourieEDG I tried out hiting the persistent query within the browser and getting the desired result.

Shailesh_Bassi__0-1693245538048.png

Can you share how are you creating the URL for hitting the endpoint URL?

Avatar

Community Advisor

Upon further investigation on both AEM Cloud (v2023.8.13099.20230810t160553z-230702) and AEM 6.5 SP18, found the "String to Int" casting error in the AEM Cloud. Interestingly, the SP18 version executed the persistent query flawlessly without encountering any errors. FYI @ArnoFourieEDG 

Avatar

Level 2

Update:  The query seems to work fine on 2023.7.12874 but not on 2023.8.13206...

 

Underlying issue seems to be regression testing.

 

 

Avatar

Correct answer by
Level 2

This is a known issue apparently:

 

" SITES-15622: GraphQL - Issue with persisted queries with number & boolean parameters "