How to increase the default number of results (30) in graphql?

How can I increase the default number of results in graphql query results? I am receiving 30 results and I want to fetch 100. How to do this?
7 Replies
thomast
thomast4mo ago
Hi @arnavsaxena, can you provide the query you are using? I guess you can add the param limit to the query
arnavsaxena
arnavsaxenaOP4mo ago
Even after adding : { "limit": 1000, }, I am receiving only 30 results.
thomast
thomast4mo ago
can you provide the query
arnavsaxena
arnavsaxenaOP4mo ago
query: "query FindManyPeople($filter: PersonFilterInput, $orderBy: [PersonOrderByInput], $lastCursor: String, $limit: Int) { people(filter: $filter, orderBy: $orderBy, first: $limit, after: $lastCursor) { edges { node{ id } cursor } } }" operationName: "FindManyPeople" variables: " { "limit": 1000, "lastCursor":"WyIwNWI2Mzk4NC05YWFhLTRkMDItOTc5Ny0zNzFlN2U3MWVjMDIiXQ==" }"
thomast
thomast4mo ago
Looks like the max limit is 60 Since you are using JS you could do something like:
query FindManyPeople($filter: PersonFilterInput, $orderBy: [PersonOrderByInput], $lastCursor: String, $limit: Int) {
people(filter: $filter, orderBy: $orderBy, first: $limit, after: $lastCursor) {
pageInfo {
hasNextPage
endCursor
}
edges {
node{
id
}
cursor

}
}
}
query FindManyPeople($filter: PersonFilterInput, $orderBy: [PersonOrderByInput], $lastCursor: String, $limit: Int) {
people(filter: $filter, orderBy: $orderBy, first: $limit, after: $lastCursor) {
pageInfo {
hasNextPage
endCursor
}
edges {
node{
id
}
cursor

}
}
}
And while hasNextPage is true, you set lastCursor param to your previous endCursor
arnavsaxena
arnavsaxenaOP4mo ago
So this has to go in a while loop?
charles
charles4mo ago
yes! the current maximum page size is 60, it's a bit too heavy for the backend otherwise and could impact other users
Want results from more Discord servers?
Add your server