Hi, I am new to Shopify App development, and am using APPBRIDGE to build my embedded app based on THIS tutorial.
My app has a requirement to store some global app settings in the shop's Metafields. I had been planning to use GraphQL for the whole app, but discovered that this functionality is only available via the REST interface:
Can someone share how I can make these REST calls given the above technology stack?
I'll skip your question for the moment and ask you another. What data do you need to store in a shop metafield? Metafields are not a protected resource so if you're storing critical settings in there keep in mind another app/tool could alter or delete them. If that's a problem then metafields are not the right place for that data.
We will store global settings that are used internally by our app that are specific to the shop.
We are not worried about another app maliciously manipulating data within our namespace.
That being said, is this a problem faced by other app developers?
There certainly could be some app devs out there that don't want to store app specific data on their own servers. I hope none do as it's a poor/risky approach given how quick it is to spin up some form of db app side. It also creates garbage in the shops metafield data come uninstallation time. Your app may be removed but the metafield will still remain.
In the REST API docs there's an example for creating a shop metafield.
Where did you get stuck?
I looked at the link you provided. I get that this is the endpoint for writing an admin metafield.
The problem I am having is that I do not know how to use APPBRIDGE to do a post?
Can you point me to an example of how to accomplish this with APPBRIDGE?