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
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",
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
JSON{
"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
JSON{
"articleUpdate": {
"article": {
"id": "gid://shopify/Article/959752435",
"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",
"originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/articles/fake_image.jpg?v=1730243702"
}
},
"userErrors": []
}
}