Development discussions around Shopify APIs
Hello,
There's definitely something wrong with the Metafields API unless I missed some recent changes. I'm just trying to get a list of meta fields for a specific product. I was surprised to see it returns 'shop' meta field instead. I also tried adding a 'product' meta field and received an existing 'shop' meta field in the response.
Here are the request details (with hidden sensitive data):
REQUEST URI:
{
pathname: '/admin/api/2021-10/metafields.json',
hostname: '*****.myshopify.com',
protocol: 'https:',
search: '?owner_id=******&owner_resource=product'
}
REQUEST OPTIONS:
{
"headers": {
"User-Agent": "shopify-api-node/3.8.0",
"Authorization": "Basic ****************"
},
"timeout": 60000,
"responseType": "json",
"retry": 0,
"method": "GET"
}
RESPONSE BODY {
metafields: [
{
id: ****,
namespace: '***',
key: 'google_analytics_id',
value: '****',
value_type: 'string',
description: null,
owner_id: *****,
created_at: '2021-11-07T20:27:42+00:00',
updated_at: '2021-11-07T20:27:42+00:00',
owner_resource: 'shop',
type: 'single_line_text_field',
admin_graphql_api_id: 'gid://shopify/Metafield/****'
},
{
id: *****,
namespace: '*****',
key: 'rings',
value: '{"fmrs_enabled":1,"sizes":[4,5,6,7,8,9,10,11,12,13]}',
value_type: 'json_string',
description: null,
owner_id: ******,
created_at: '2021-11-07T20:27:43+00:00',
updated_at: '2021-11-07T20:27:43+00:00',
owner_resource: 'shop',
type: 'json',
admin_graphql_api_id: 'gid://shopify/Metafield/******'
}
]
}
Any idea why it may happen?
I encapsulated the metafield object inside a metafield key to fix this error. What is strange is the API doesn't return any error but instead show random metafields.
I know this was a year ago, but can you tell me how you solved this? It's happening to me too and I don't understand your note above.
User | RANK |
---|---|
44 | |
16 | |
9 | |
9 | |
7 |
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023