Ruby: MetaFields are not accessible via REST API

Hi there!

I am working on Ruby on Rails, I have used a gem called shopify_api.
I have created a few meta fields on the dashboard(Settings → Custom data → Products), These fields are visible on the dashboard & each product detail page but when I tried to fetch them via API, it didn’t return those fields.

      session = ShopifyAPI::Auth::Session.new(
        shop: shopify_domain,
        access_token: shopify_token
      )
      @client = ShopifyAPI::Clients::Rest::Admin.new(
        session: session
      )
      response = @client.get(path: 'metafields', query: { limit: 250 })
      metafields = response.body['metafields']

Then I used an API for creating metafields, These fields were created successfully but they show under unstructured(Settings → Custom data → Products → top button ‘View unstructured metafields’). These fields created from API are also not showing on the product detail page until I click on ‘View unstructured metafields’