Query metaobject by handle

Solved

Query metaobject by handle

JohnWiles74
Shopify Partner
2 1 0

I am using Celigo to create physician metaobjects in Shopify from customers in Acumatica.  We want to maintain a list of physicians who do business with Sente Labs on a regular basis.  What that implies is that if the customer has made a purchase within the past 6 months, then we want to create/update the physician record in Shopify (if it has been modified).  But if the physician has not made a purchase within the past 6 months, then we want to delete the physician record from Shopify.

In order to delete the physician record, we need the id of the metaobject.  The id is not available when you use the UpsertMetaobject mutation.  But in the Manage Metaobjects section of the development document, I found a metaobjectByHandle query and it looked like I might be able to add the id to the query.  So here is what I submitted:

{

  metaobjectByHandle(handle: {

    type: "$app:physician_model",

    handle: "S-0000467_109491"

  }) {

    displayName

    id

    handle

  }

}

When I look at the response, it returns:

"data": {

    "metaobjectByHandle": null

}

Any help would be appreciated.

Accepted Solution (1)
JohnWiles74
Shopify Partner
2 1 0

This is an accepted solution.

LizK,

 

You lost me a little in the terminology.  I had someone point out that I don't want the $app: in the line:   

type: "$app:physician_model",

Once, I removed that, I am receiving the data I need.

Thank you for your quick response.

John

 

View solution in original post

Replies 3 (3)

lizk
Shopify Staff
246 58 79

Hi there 👋

Could you share the mutation that is being used to create the metaobject?

Could you confirm if the API that you are using to query for the metaobject is the same API that Celigo is using to create the metaobject.

If you create a metaobject under a namespace that is owned by Celigo, and you don't specify an access setting for it, then the definition will be private to Celigo. And would only be returned to that API key.

To learn more visit the Shopify Help Center or the Community Blog.

JohnWiles74
Shopify Partner
2 1 0

This is an accepted solution.

LizK,

 

You lost me a little in the terminology.  I had someone point out that I don't want the $app: in the line:   

type: "$app:physician_model",

Once, I removed that, I am receiving the data I need.

Thank you for your quick response.

John

 

lizk
Shopify Staff
246 58 79

Glad you were able to resolve it!
Yes, the $app prefix specifies metaobject that it is owned by a specific app. 

To learn more visit the Shopify Help Center or the Community Blog.