1

I am using cursor for pagination in Graphql query, I want to also get total records count with the response, How can I achieve?

query GenericQuery {
    items(
        filter: {publicationIds: 1, itemTypes: [COMPONENT], schema: {id: 112233}}
        first: 3
        after: "Mw=="
    ) {
        edges {
            node {
                itemId
                title
                lastPublishDate
                itemType
                ... on Component {
                    title
                    multiMedia
                    content(renderContent: true) {
                        ... on UntypedContent {
                            data
                        }
                    }
                }
            }
            cursor
        }
    }
}

1 Answer 1

1

The total count field is not available.

One workaround is to use a separate query to get the total count.

You can execute a second query with the same filter criteria but without the pagination arguments (e.g., first, after, etc.), and then retrieve the total count from the response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.