Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct API guidance #2488

Draft
wants to merge 3 commits into
base: unstable
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const data: LandingTemplateSchema = {
type: 'Generic',
title: 'Direct API access',
sectionContent:
"You can make Shopify Admin API requests directly from your extension using the [query API](/docs/api/admin-extensions/api/standard-api#standardapi-propertydetail-query) or the standard [web fetch API](https://developer.mozilla.org/en-US/docs/Web/API/fetch)!\n\nAny `fetch()` calls from your extension to Shopify's Admin GraphQL API are automatically authenticated by default. These calls are fast too, because Shopify handles requests directly.\n\nDirect API requests use [online access](https://shopify.dev/docs/apps/build/authentication-authorization/access-token-types/online-access-tokens) mode by default. If you want to use [offline access](https://shopify.dev/docs/apps/build/authentication-authorization/access-token-types/offline-access-tokens) mode, you can set the `direct_api_mode` property to `offline` in your [app TOML file](/docs/apps/tools/cli/configuration#admin).\n\nNote: Direct API can't be used to manage storefront access tokens.",
'You can make Shopify Admin API requests directly from your extension using the [query API](/docs/api/admin-extensions/api/standard-api#standardapi-propertydetail-query) or the standard [web fetch API](https://developer.mozilla.org/en-US/docs/Web/API/fetch). Use Direct API when you need to make requests to Shopify APIs. Don\'t use Direct API when you need to make requests to non-Shopify APIs.\n\nAny `fetch()` calls from your extension to Shopify\'s GraphQL Admin API are automatically authenticated by default. These calls are fast too, because Shopify handles requests directly.\n\nDirect API requests use [online access](https://shopify.dev/docs/apps/build/authentication-authorization/access-token-types/online-access-tokens) mode by default. If you want to use [offline access](https://shopify.dev/docs/apps/build/authentication-authorization/access-token-types/offline-access-tokens) mode, you can set the `direct_api_mode` property to `offline` in your [app TOML file](/docs/apps/tools/cli/configuration#admin).\n\nUse Direct API in [Admin action](https://shopify.dev/docs/apps/build/admin/actions-blocks#admin-actions) and [Admin block](https://shopify.dev/docs/apps/build/admin/actions-blocks#admin-blocks) UI extensions and in embedded apps.\n\nYou enable Direct API differently for Admin UI extensions and embedded apps.\n\nTo configure Direct API for an Admin UI extension:\n\n1.In your app\'s `.toml` file, set `[access.admin]`.\n\n2.For online access, under `[access.admin]`, set `direct_api_mode = "online"`.\n\n3.For offline access, under `[access.admin]` set `direct_api_mode = "offline"`.\n\nTo configure Direct API for an embedded app:\n\n1.In your app\'s `.toml` file, set `[access.admin]`.\n\n2.For online access, under `[access.admin]`, set `embedded_app_direct_api_access = "online"`.\n\n3.For offline access, under `[access.admin]`, set `embedded_app_direct_api_access = "offline"`.',
anchorLink: 'direct-api-access',
codeblock: {
title: 'Query Shopify data',
Expand Down
Loading