Skip to main content

Admin API

Contains objects used to interact with the Admin API.

This object is returned as part of different contexts, such as admin, unauthenticated.admin, and webhook.

Provides utilities that apps can use to make requests to the Admin API.

FeatureEnabled<ConfigArg['future'], 'removeRest'> extends true ? AdminApiContextWithoutRest : AdminApiContextWithRest<Resources>
Anchor to AdminApiContextWithRest

AdminApiContextWithRest

Anchor to graphql
graphql
<AdminOperations>
required

Methods for interacting with the Shopify Admin GraphQL API

<Resources>
required

Methods for interacting with the Shopify Admin REST API

Deprecated

In a future major release REST will be removed from this package. Please see all-in on graphql.

There are methods for interacting with individual REST resources. You can also make GET, POST, PUT and DELETE requests should the REST resources not meet your needs.

{@link https://shopify.dev/docs/api/admin-rest}

Anchor to AdminApiContextWithoutRest

AdminApiContextWithoutRest

Anchor to graphql
graphql
<AdminOperations>
required

Methods for interacting with the Shopify Admin GraphQL API

Future extends ? Future[Flag] extends true ? true : false : false
Examples
import { ActionFunctionArgs } from "@remix-run/node";
import { authenticate } from "../shopify.server";

export const action = async ({ request }: ActionFunctionArgs) => {
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
`#graphql
mutation populateProduct($input: ProductInput!) {
productCreate(input: $input) {
product {
id
}
}
}`,
{
variables: {
input: { title: "Product Name" },
},
},
);

const productData = await response.json();
return json({
productId: productData.data?.productCreate?.product?.id,
});
}


Was this page helpful?