Get all metafields for products

Hi All,

As everyone recommended GraphQL for better querying, we thought of trying this but from our initial testing, it seems like it’s not giving a big advantage to us in querying.

using a REST API, we can get one product’s 250 metafields in one call using “admin/products/{{id}}/metafields.json?limit=250” call. When it comes to GraphQL, the query cost is controlling us to have a maximum of 3 products at a time in the call i.e

{
  products(first: 3) {
    edges {
      node {
        legacyResourceId
        metafields (first: 250) {
          edges {
            node {
              legacyResourceId
              value
              namespace
              key
            }
          }
        }
      }
    }
  }
}
  1. Is there any better way of querying for this purpose?
  2. Also, all resources in GraphQL don’t have the main filter supported by REST API i.e ID. So how GraphQL is recommended if we have to fetch details for certain ids?
  3. As per Shopify, admin_graphql_api_id is not constant and it’s not recommended to prepare the gid structure programmatically. So Shopify is expecting us to make a REST API call first to know the gids and then use GraphQL for querying?