Skip to content

How to query products via graphql

I’m querying the graphql endpoint of a magento test installation, and am constructing and sending an oauth 1.0 authorization header via an integration setup.

When I query the products via a simple graphql query like so:

query Products {
    products(
        filter: { price: { from: "0" } }
        pageSize: 20
        currentPage: 1
        sort: { name: DESC }
    ) {
        items {
            sku
        }
    }
}

I get no data as a result –

{
    "data": {
        "products": {
            "items": []
        }
    }
}

Could it be an issue with the authorization header? I’ve tested the header via the REST routes and it works ok there.

Thanks