Anchor to articleUpdatearticle
articleUpdate
mutation
Requires Any of ,
access scopes.
Updates an article.
Anchor to Arguments
Arguments
- Anchor to articlearticle•Article
Update requiredInput! The properties of the article to be updated.
- Anchor to blogblog•
The properties of the blog to be created.
- •ID!required
The ID of the article to be updated.
Was this section helpful?
Anchor to ArticleUpdatePayload returnsArticleUpdatePayload returns
- Anchor to articlearticle•
The article that was updated.
- Anchor to userErrorsuser•
Errors [ArticleUpdate non-nullUser Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Updates an article
- articleUpdate reference
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation UpdateArticle($id: ID!, $article: ArticleUpdateInput!) {6 articleUpdate(id: $id, article: $article) {7 article {8 id9 title10 handle11 body12 summary13 tags14 image {15 altText16 originalSrc17 }18 }19 userErrors {20 code21 field22 message23 }24 }25 }`,26 {27 variables: {28 "id": "gid://shopify/Article/959752435",29 "article": {30 "title": "Updated Article Title",31 "handle": "updated-article-title",32 "body": "This is the updated content of the article.",33 "summary": "This is an updated summary of the article.",34 "tags": [35 "UpdatedTag1",36 "UpdatedTag2"37 ],38 "image": {39 "altText": "Updated alt text for the image",40 "url": "http://example.com/fake_image.jpg"41 }42 }43 },44 },45);4647const data = await response.json();48
mutation UpdateArticle($id: ID!, $article: ArticleUpdateInput!) {
articleUpdate(id: $id, article: $article) {
article {
id
title
handle
body
summary
tags
image {
altText
originalSrc
}
}
userErrors {
code
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation UpdateArticle($id: ID!, $article: ArticleUpdateInput!) { articleUpdate(id: $id, article: $article) { article { id title handle body summary tags image { altText originalSrc } } userErrors { code field message } } }",
"variables": {
"id": "gid://shopify/Article/959752435",
"article": {
"title": "Updated Article Title",
"handle": "updated-article-title",
"body": "This is the updated content of the article.",
"summary": "This is an updated summary of the article.",
"tags": [
"UpdatedTag1",
"UpdatedTag2"
],
"image": {
"altText": "Updated alt text for the image",
"url": "http://example.com/fake_image.jpg"
}
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation UpdateArticle($id: ID!, $article: ArticleUpdateInput!) {
articleUpdate(id: $id, article: $article) {
article {
id
title
handle
body
summary
tags
image {
altText
originalSrc
}
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/Article/959752435",
"article": {
"title": "Updated Article Title",
"handle": "updated-article-title",
"body": "This is the updated content of the article.",
"summary": "This is an updated summary of the article.",
"tags": [
"UpdatedTag1",
"UpdatedTag2"
],
"image": {
"altText": "Updated alt text for the image",
"url": "http://example.com/fake_image.jpg"
}
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation UpdateArticle($id: ID!, $article: ArticleUpdateInput!) {
articleUpdate(id: $id, article: $article) {
article {
id
title
handle
body
summary
tags
image {
altText
originalSrc
}
}
userErrors {
code
field
message
}
}
}`,
"variables": {
"id": "gid://shopify/Article/959752435",
"article": {
"title": "Updated Article Title",
"handle": "updated-article-title",
"body": "This is the updated content of the article.",
"summary": "This is an updated summary of the article.",
"tags": [
"UpdatedTag1",
"UpdatedTag2"
],
"image": {
"altText": "Updated alt text for the image",
"url": "http://example.com/fake_image.jpg"
}
}
},
},
});
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 UpdateArticle($id: ID!, $article: ArticleUpdateInput!) {
articleUpdate(id: $id, article: $article) {
article {
id
title
handle
body
summary
tags
image {
altText
originalSrc
}
}
userErrors {
code
field
message
}
}
}
QUERY
variables = {
"id": "gid://shopify/Article/959752435",
"article": {
"title": "Updated Article Title",
"handle": "updated-article-title",
"body": "This is the updated content of the article.",
"summary": "This is an updated summary of the article.",
"tags": ["UpdatedTag1", "UpdatedTag2"],
"image": {
"altText": "Updated alt text for the image",
"url": "http://example.com/fake_image.jpg"
}
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "id": "gid://shopify/Article/959752435",3 "article": {4 "title": "Updated Article Title",5 "handle": "updated-article-title",6 "body": "This is the updated content of the article.",7 "summary": "This is an updated summary of the article.",8 "tags": [9 "UpdatedTag1",10 "UpdatedTag2"11 ],12 "image": {13 "altText": "Updated alt text for the image",14 "url": "http://example.com/fake_image.jpg"15 }16 }17}
Response
JSON1{2 "articleUpdate": {3 "article": {4 "id": "gid://shopify/Article/959752435",5 "title": "Updated Article Title",6 "handle": "updated-article-title",7 "body": "This is the updated content of the article.",8 "summary": "This is an updated summary of the article.",9 "tags": [10 "UpdatedTag1",11 "UpdatedTag2"12 ],13 "image": {14 "altText": "Updated alt text for the image",15 "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/articles/fake_image.jpg?v=1730243702"16 }17 },18 "userErrors": []19 }20}