Trying to add a new entry for the meta-object with API

Hi,
I’m trying to add a new entry for the meta-object called product_relationship, I mean new data like a new product in the product object so the same for meta-object API,
I read this documentation
https://shopify.dev/docs/apps/custom-data/metaobjects/manage-metaobjects
I tried this request according to the guide:

mutation {
  metaobjectCreate(metaobject: {
    type: "$app:product_relationship",
    fields: [
      {
        key: "group",
        value: "b"
      },
      {
        key: "prodcut",
        value: "gid://shopify/prodcut/6931492569178"
      }
    ]
  }) {
    metaobject {
      id
      type
      group: field(key: "group") { value }
      prodcut: field(key: "prodcut") { value },
    }
  }
}

But I get this response:

{
    "data": {
        "metaobjectCreate": {
            "metaobject": null
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 12,
            "actualQueryCost": 10,
            "throttleStatus": {
                "maximumAvailable": 2000.0,
                "currentlyAvailable": 1990,
                "restoreRate": 100.0
            }
        }
    }
}

Thanks!

Hi Neryaelul,

This does sound strange - did running metaobjectDefinitionCreate before (like in step 1 here) work as expected?

The problem was that I couldn’t add it because it seems that definition meta-objects created in the administration interface (admin) cannot be added to them in the API App.

Glad you figured out the problem!