Version: 2024-10
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"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 } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Article/959752435\",\n \"article\": {\n \"title\": \"Updated Article Title\",\n \"handle\": \"updated-article-title\",\n \"body\": \"This is the updated content of the article.\",\n \"summary\": \"This is an updated summary of the article.\",\n \"tags\": [\n \"UpdatedTag1\",\n \"UpdatedTag2\"\n ],\n \"image\": {\n \"altText\": \"Updated alt text for the image\",\n \"url\": \"http://example.com/fake_image.jpg\"\n }\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation UpdateArticle($id: ID!, $article: ArticleUpdateInput!) {\n articleUpdate(id: $id, article: $article) {\n article {\n id\n title\n handle\n body\n summary\n tags\n image {\n altText\n originalSrc\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Article/959752435\",\n \"article\": {\n \"title\": \"Updated Article Title\",\n \"handle\": \"updated-article-title\",\n \"body\": \"This is the updated content of the article.\",\n \"summary\": \"This is an updated summary of the article.\",\n \"tags\": [\n \"UpdatedTag1\",\n \"UpdatedTag2\"\n ],\n \"image\": {\n \"altText\": \"Updated alt text for the image\",\n \"url\": \"http://example.com/fake_image.jpg\"\n }\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation UpdateArticle($id: ID!, $article: ArticleUpdateInput!) {\n articleUpdate(id: $id, article: $article) {\n article {\n id\n title\n handle\n body\n summary\n tags\n image {\n altText\n originalSrc\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Article/959752435\",\n \"article\": {\n \"title\": \"Updated Article Title\",\n \"handle\": \"updated-article-title\",\n \"body\": \"This is the updated content of the article.\",\n \"summary\": \"This is an updated summary of the article.\",\n \"tags\": [\"UpdatedTag1\", \"UpdatedTag2\"],\n \"image\": {\n \"altText\": \"Updated alt text for the image\",\n \"url\": \"http://example.com/fake_image.jpg\"\n }\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation UpdateArticle($id: ID!, $article: ArticleUpdateInput!) {\n articleUpdate(id: $id, article: $article) {\n article {\n id\n title\n handle\n body\n summary\n tags\n image {\n altText\n originalSrc\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Article/959752435\",\n \"article\" => [\n \"title\" => \"Updated Article Title\",\n \"handle\" => \"updated-article-title\",\n \"body\" => \"This is the updated content of the article.\",\n \"summary\" => \"This is an updated summary of the article.\",\n \"tags\" => [\"UpdatedTag1\", \"UpdatedTag2\"],\n \"image\" => [\n \"altText\" => \"Updated alt text for the image\",\n \"url\" => \"http://example.com/fake_image.jpg\",\n ],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation UpdateArticle($id: ID!, $article: ArticleUpdateInput!) {\n articleUpdate(id: $id, article: $article) {\n article {\n id\n title\n handle\n body\n summary\n tags\n image {\n altText\n originalSrc\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Article/959752435\",\n \"article\": {\n \"title\": \"Updated Article Title\",\n \"handle\": \"updated-article-title\",\n \"body\": \"This is the updated content of the article.\",\n \"summary\": \"This is an updated summary of the article.\",\n \"tags\": [\n \"UpdatedTag1\",\n \"UpdatedTag2\"\n ],\n \"image\": {\n \"altText\": \"Updated alt text for the image\",\n \"url\": \"http://example.com/fake_image.jpg\"\n }\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation UpdateArticle($id: ID!, $article: ArticleUpdateInput!) {\n articleUpdate(id: $id, article: $article) {\n article {\n id\n title\n handle\n body\n summary\n tags\n image {\n altText\n originalSrc\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "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: { "data": { "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": [] } } }