How to search with pagination in search app?

https://xxxxxxxxxx.swiftype.com/api/as/v1/engines/xxxxxxxx/search?page[size]=15&page[current]=2&query=jam&filters[is_deleted]=0&sort[total_sold]=desc

This my error :
"Page contains invalid option: size; must be an integer",
"Page contains invalid option: current; must be an integer"

how to can i to fix this error help me please

Hi @Ricky_Tokdis.

The search payload should be set as a request body, not as query parameters. Examples can be found here: https://swiftype.com/documentation/app-search/api/search/filters

Just out of curiosity: did you find some docs saying that query parameters, as you're using, would also work?

i am using query parameter, if i not use page in query parameter it can be work it

You're right - unfortunately the search endpoint does not currently fully support query parameters for all options. So you would need to create a JSON request body, as seen in the documentation page I previously linked to.

okay sir, thank you very much to your response

now in my endpoint, i am request method GET and send parameter to request body ?

Yes, GET request with a JSON body would work but some HTTP libraries might not support that. So a POST request would be the option I would go with.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.