My scenario is that I have an admin tool that talks to a 3rd party. To do that you need to register on the 3rd party which will give you and API key which you then enter into the admin interface I’ve created within shopify.
My question is where should I be saving that data within GraphQL?
The initial thought was to store it against metafields of the shop.
But is that the right place to store it and does anyone have any examples of saving and loading that data within the admin?
Thanks for the reply. That’s a massive help. I’m getting a positive response from the Mutation query:
data:
metafieldsSet:
metafields:
0:
createdAt:"2024-05-15T12:44:22Z"
key:"api-key"
namespace:"pluggle-shopify"
updatedAt:"2024-05-30T13:17:34Z"
value:"1234"
I’ve got this code for reading it:
const queryData = `
{
shop {
metafield(namespace: "` + metafieldNamespace + `", key: "` + metafieldKey + `") {
value
}
}
}`;
const apiKey = await admin.graphql(queryData);
Where the namespace and key match the mutation. But for some reason I get no response from the api.