Anchor to pageUpdatepage
pageUpdate
mutation
Requires Any of ,
access scopes.
Updates a page.
Anchor to Arguments
Arguments
- •ID!required
The ID of the page to be updated.
- Anchor to pagepage•Page
Update requiredInput! The properties of the page to be updated.
Was this section helpful?
Anchor to PageUpdatePayload returnsPageUpdatePayload returns
- Anchor to pagepage•
The page that was updated.
- Anchor to userErrorsuser•
Errors [PageUpdate non-nullUser Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Updates a page
- pageUpdate reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation UpdatePage($id: ID!, $page: PageUpdateInput!) {
pageUpdate(id: $id, page: $page) {
page {
id
title
handle
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/Page/602767277",
"page": {
"title": "This is the Title",
"handle": "this-is-the-handle"
}
},
},
);
const data = await response.json();
mutation UpdatePage($id: ID!, $page: PageUpdateInput!) {
pageUpdate(id: $id, page: $page) {
page {
id
title
handle
}
userErrors {
code
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation UpdatePage($id: ID!, $page: PageUpdateInput!) { pageUpdate(id: $id, page: $page) { page { id title handle } userErrors { code field message } } }",
"variables": {
"id": "gid://shopify/Page/602767277",
"page": {
"title": "This is the Title",
"handle": "this-is-the-handle"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation UpdatePage($id: ID!, $page: PageUpdateInput!) {
pageUpdate(id: $id, page: $page) {
page {
id
title
handle
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/Page/602767277",
"page": {
"title": "This is the Title",
"handle": "this-is-the-handle"
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation UpdatePage($id: ID!, $page: PageUpdateInput!) {
pageUpdate(id: $id, page: $page) {
page {
id
title
handle
}
userErrors {
code
field
message
}
}
}`,
"variables": {
"id": "gid://shopify/Page/602767277",
"page": {
"title": "This is the Title",
"handle": "this-is-the-handle"
}
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation UpdatePage($id: ID!, $page: PageUpdateInput!) {
pageUpdate(id: $id, page: $page) {
page {
id
title
handle
}
userErrors {
code
field
message
}
}
}
QUERY
variables = {
"id": "gid://shopify/Page/602767277",
"page": {
"title": "This is the Title",
"handle": "this-is-the-handle"
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"id": "gid://shopify/Page/602767277",
"page": {
"title": "This is the Title",
"handle": "this-is-the-handle"
}
}
Response
JSON{
"pageUpdate": {
"page": {
"id": "gid://shopify/Page/602767277",
"title": "This is the Title",
"handle": "this-is-the-handle"
},
"userErrors": []
}
}