Shopify / shopify-app-bridge

https://shopify.dev/docs/api/app-bridge
86 stars 9 forks source link

Can Direct API access be used for the REST API? #414

Open zeyios opened 3 weeks ago

zeyios commented 3 weeks ago

In my app, I've successfully used Direct API access with the GraphQL API like this:

const response = await fetch(
  `shopify:admin/api/${API_VERSION}/graphql.json`,
  {
    method: 'POST',
    body: JSON.stringify({ query, variables }),
  }
);

However, when I try to use the same approach for the REST API, it doesn’t work:

const result = await fetch(
  `shopify:admin/api/${API_VERSION}/themes.json`,
  {}
);

console.log('result', result);

I get the following error: Fetch API cannot load shopify:admin/api/2024-07/themes.json. URL scheme "shopify" is not supported.

darrynten commented 3 weeks ago

I don't think that will ever be possible, it also seems like rest will eventually be entirely replaced with graph over time so transition your calls to graph as you move them over to the new direct api.

The themes endpoints just arrived in unstable

waleedarshad commented 1 day ago

@darrynten It is mentioned in their offical documentation. https://shopify.dev/docs/api/app-bridge-library#direct-api-access

but not working. Is the docs outdated?