phpclassic / php-shopify

PHP SDK for Shopify API
Apache License 2.0
568 stars 211 forks source link

Any way to perform GraphQL queries as if they are coming from the Shopify Admin? #317

Open threedytotal opened 7 months ago

threedytotal commented 7 months ago

I need to access some GraphQL queries that are used from inside the Shopify Admin but that aren't yet exposed in the public APIs. Is there any way to do this?

The URL that the Shopify Admin is hitting is https://admin.shopify.com/api/shopify/?operation=PurchaseOrderList&type=query and the query is for PurchaseOrderList and purchaseOrders.

Attempting to perform the same query via the iGraphQL app or using the php-shopify's GraphQL gives errors that indicate that those queries aren't known about in even the unstable API.

Using Chrome dev tools to extract the full Shopify Admin request results in a curl command that can be run outside of the admin with no apparent problems. It looks like the request is authenticated via cookies, so perhaps there is something in there that is marking the request as 'allowed to use the private API', but cookies can't be sent when using the basic authentication.

Anyone got any ideas what could be done here? Is it possible to generate login cookies using the php-shopify app and then craft a custom curl command that would fetch the information needed for example?

Cheers