Given product-handle, how to get its rating with API?

On the frontend side of my app, I want to get the review counts, and the average rating of the product. How can I get it? I already have the storefront API key and I think this is needed for what I need. But I was unable to get it to work.

Here is my query:

const query = `
    {
      product(handle: "my-product-handle") {
        title
        description
        priceRange {
          minVariantPrice {
            amount
            currencyCode
          }
        }
        rating: metafield(namespace: "custom", key: "rating") {
          value
          type
        }
      }
    }
  `;

Here, everything works but the rating returns null. I was working on this for days, so any kind of help is appreciated

Hey, trying the same thing and getting null as well. Did you ever figure this out?