I'm trying to build an embedded app using Polaris that can create and edit metafields on blog articles.
While looking through the API the GraphQL API simply seems unable to do so and the rest API also seems to be fairly useless if I may say so since it requires the blog ID as well as the article ID for some reason.
The problem with that is that you do NOT get the blog ID when you open up the app from the article itself, you only get the article ID and the origin shop as parameter which makes this kinda pointless.
Is there ANY way to create/update article metafields with just the Article ID?
(also how does the authentication for the rest api work anyways in embedded apps, straight up fetch doesn't seem to work because of CORS)
I agree, Shopify GraphQL is only half-baked and at this point pretty useless to me, so I still use REST for everything.
Not sure what you mean by Polaris app - Polaris is merely a UX style guide.
To alter Article Metafields, you don't need the Blog ID - the Article IDs are unique across all blogs, so that's all you need.
You can get all articles (for all Blogs) by doing this:
This will give you a list of all Articles (and the Blog they belong to).
You can then simply use the Article ID to create a Metafield for an Article:
Updating the Metafield is a bit trickier if you don't know its ID. In this case you need to retrieve the Metafield first via its Key and then use its ID to update/delete it.
Hope that helps.