GraphQl equivalent to GET REST endpoints

Hi,

Our apps rely on the data sent from webhooks. Conveniently, we can query the same data using the REST API via GET endpoints.

For example, when a new user installs the app, we need to get all their products, we run an initial script to get all products from the REST API.

To remove all our API calls from REST API to GraphQl API, we’ll need to create an GraphQl equivalent or the GET REST endpoints, this allows us to not change our internal data.

Does the Shopify team has migrate code we can use to move from:

const product = await shopifyRestApi.get('product/123.json')

to

const productGql = await shopifyGqlApi(...)
const product = prtoductGqlToRest(productGql)

Thank you

I believe you will need to restructure your code to support how GraphQL returns the data unfortunately.

You could either restructure your data or you will need to map the GraphQL response to the webhook format. The docs now indicate what field maps to what in GraphQL so that could help you Product - REST