How to access metaobjects via REST?

Rusticandmain
Visitor
2 0 8

Hey all, as you may know, we can access metafield data through a quick query like this:
https://{{yourStore}}.myshopify.com/admin/products/{{prodId}}/metafields/{{metafieldId}}.json

 

In the case where a metafield is a reference to a metaobject it will return the following JSON:

{"metafield":{"id":XXXXX,"namespace":"custom","key":"ring_info","value":"gid:\/\/shopify\/Metaobject\/2593325140","value_type":"string","description":null,"owner_id":xxxxxx,"created_at":"2023-04-24T11:48:30-04:00","updated_at":"2023-04-24T11:48:30-04:00","owner_resource":"product","type":"metaobject_reference","admin_graphql_api_id":"gid:\/\/shopify\/Metafield\/20172247859284"}}

However, I don't know what endpoint to use to get the values for the specific metaobject.

 

I've seen some stuff about this using graphql, which I'm willing to try, but it's not intuitive IMO.

This is for a custom javascript action in Zapier. Many thanks!

Replies 2 (2)

garyrgilbert
Shopify Partner
390 40 162

Apparently there is no metaobjects rest api endpoint (I've searched long and hard for it).

 

You are going to have to use graphql for this one.

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

Technologic
Shopify Partner
8 0 7

I wish Shopify would enable access to the Meta Objects via the Ajax API, or the REST Admin API, If you fetch product with either of these meta data is not available. Its incredibly hard to make use of the meta fields and objects.
Currently having to fetch the product with ajax api to get the id, fetch a server side route with the id which performs a fetch to the Rest metafield endpoint which returns a meta object id, now it appears we will have to fetch the meta object from the graphql api, before getting the simple piece of data we need, a case count to modify the order with.