App Extension still sends Rest ID, How to switch to GID

Highlighted
Shopify Expert
4175 29 400

So this has come up a few times where we have the following:

Rest API ID

GraphQL API ID

A lot of people say nanny nanny booboo use the admin legacy ID but don't fake making a RestAPI into a GraphQL ID because heavens to Betsy one day Shopify might inventory numbers that don't coform to each format nicely.

So I go through all the trouble to craft a GraphQL App and need to access a product's metafields, but all I get from the App extension is the ID. The old skool Rest ID. So now how do I square that circle. Obviously I can fake it and turn into a GID with my helper, but that is not top notch computing. 

Can Shopify illuminate for us in the outer worlds how we are supposed to change the App setup so we get handed a GID for our work? Or is that not possible? Will it ever be possible?

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Highlighted
Shopify Partner
520 38 109
0 Likes
Highlighted
Shopify Expert
4175 29 400

Right,. As that article points out, there remains ZERO support for App Extensions in this area of work. Making them awkward to use.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Highlighted
New Member
2 0 0

Ridiculous isn't it.

I'm having the same issue and also can't go back to using the old REST API because the App Bridge components like Resource Picker are all using GraphQL ID...

I figure I'm just going to have to go against what the docs say and build the ID manually until something is done about it.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
49 10 15

Hi all,

If you have the ID number you can use the `composeGid` method from '@shopify/admin-graphql-api-utilities' to construct the GraphQL ID.

See the docs for more info: https://github.com/Shopify/quilt/tree/master/packages/admin-graphql-api-utilities#function-composegi...

0 Likes
Highlighted
Shopify Expert
4175 29 400

Thanks Trish_Ta

The thing is, some of can only stomach a bare bare and I mean bare minimum of JS in our lives, so in my case, I ensure I only use JS where it is native and pretty much the only viable solution, the front-end.

And while I appreciate that JS has evolved (note sarcasm) to have a helper function to wipe one's butt, the fact is, we crafted the same helper in our backend scripting language. So yes, I too have a function that given an old legacy ID, will produce a gid string. But that continues to fly in the face of "That number might not be reliable in the future".

So we remain, at least with App Extensions, in the netherworld of faking things out!

But thanks on that JS hot tip! For the poor souls that make backend JS code, I am sure they will love it!

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes