Skip to content

[ADMIN API] How can i use admin api in hydrogen #580

Answered by jinhyuk
silasbispo01 asked this question in Help
Discussion options

You must be logged in to vote

I configured the Admin API client as follows by referring to the shopify api repo.

// ~/lib/shopify.ts
import {shopifyApi, LATEST_API_VERSION} from '@shopify/shopify-api';
import {restResources} from '@shopify/shopify-api/rest/admin/2023-01';
import '@shopify/shopify-api/adapters/cf-worker';

export const shopify = shopifyApi({
  apiKey: '[YOUR KEY]',
  apiSecretKey: '[YOUR KEY],
  apiVersion: LATEST_API_VERSION,
  isCustomStoreApp: true,
  scopes: [],
  isEmbeddedApp: false,
  hostName: `[YOUR_SHOP_URL]`,
  restResources,
});

After that, I retrieved the data after importing the admin client from the loader. or Pass it with context

import {shopify} from '~/lib/shopify'

export async function

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@juanpprieto
Comment options

@silasbispo01
Comment options

Comment options

You must be logged in to vote
1 reply
@silasbispo01
Comment options

Answer selected by silasbispo01
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants