Skip to Content

article

Get a single article by ID.

Query Structure

query { article(id: ID!) { seoDescription seoTitle seoKeywords handle headerImage author { # Author fields (see Related Types) } id title content summary comments { # Comment fields (see Related Types) } commentsCount blog { # Blog fields (see Related Types) } isPublished commentsAreEnabled commentsRequireAccount commentsRequireApproval accountOwner createdAt updatedAt } }

Arguments

ArgumentTypeDescriptionRequiredDefault Value
idID!The ID of the article to retrieveYesNone

Return Type

Article

Represents an article object with content, author, and comment information.

FieldTypeDescription
seoDescriptionStringReturns description for search engines.
seoTitleStringReturns title for search engines.
seoKeywordsStringReturns keywords for search engines.
handleStringRetrieve a handle for this article.
headerImageStringRetrieve the associated header image URL for this article.
authorAuthorReturns information about the article’s author as an AuthorDrop.
idIntGet the identifier for this article.
titleStringReturns the title.
contentStringGet the content of this article.
summaryStringReturns the summary (max. 140 characters) for this article.
comments[Comment]List of published comments for this article. Empty if comments are disabled.
commentsCountIntNumber of published comments for this article.
blogBlogThe blog object this article belongs to.
isPublishedBooleanWhether this article is published (unpublished articles are visible in design mode).
commentsAreEnabledBooleanWhether commenting is enabled for this article.
commentsRequireAccountBooleanWhether commenting requires a customer account.
commentsRequireApprovalBooleanWhether comments require approval for this article.
accountOwnerBooleanReturns true if the author is the owner of the store.
createdAtStringReturns the timestamp when the article was published.
updatedAtStringReturns the timestamp when the article was updated or modified.

Examples

Basic Query

query { article(id: 12345) { id title summary createdAt } }

Advanced Query

query { article(id: 12345) { id title seoTitle seoDescription seoKeywords handle headerImage author { id name email } content summary commentsCount comments { id authorName content createdAt } blog { id title handle } isPublished commentsAreEnabled commentsRequireAccount commentsRequireApproval accountOwner createdAt updatedAt } }

Field Selection

query { article(id: 12345) { title summary author { name } comments { authorName content } } }

cURL Example

curl -X POST https://www.mystoreurl.com/graphql/0.8.0/ \ -H "Content-Type: application/json" \ -d '{"query":"query { article(id: 12345) { id title summary createdAt } }"}'

JavaScript Example

async function fetchArticle(articleId) { const query = ` query { article(id: ${articleId}) { id title summary createdAt } } `; try { const response = await fetch('https://www.mystoreurl.com/graphql/0.8.0/', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ query }), }); const { data, errors } = await response.json(); if (errors) { console.error('GraphQL errors:', errors); return null; } return data.article; } catch (error) { console.error('Network error:', error); return null; } } // Usage example fetchArticle(12345).then(article => { if (article) { console.log('Article title:', article.title); } });

Response Format

The response returns an article object containing the requested fields. For example:

{ "data": { "article": { "id": 12345, "title": "How to Optimize Your Store", "summary": "Learn the best practices to optimize your e-commerce store...", "createdAt": "2023-11-15T10:20:30Z" } } }

If the article is not found, article will be null.

Error Handling

Error CodeDescriptionResolution
BAD_USER_INPUTThe provided id argument is invalid or missing.Verify that the id is a valid integer and provided.
NOT_FOUNDNo article exists with the provided id.Confirm the article ID exists in the system.
INTERNAL_SERVER_ERRORAn unexpected error occurred on the server.Retry the request later or contact support.
RATE_LIMIT_EXCEEDEDToo many requests in a short period.Implement retry with exponential backoff.

Errors will be returned in the errors array of the GraphQL response.

Performance Considerations

  • Request only the fields you need to minimize response size and improve performance.
  • Avoid fetching large nested fields like comments unless necessary.
  • Use pagination on related fields (e.g., comments) if supported in future API versions.
  • The API enforces rate limiting; excessive requests may result in RATE_LIMIT_EXCEEDED errors.
  • Responses may be cached by intermediate proxies; consider cache headers if applicable.

Authentication

This API currently does not require authentication. However, authentication requirements may be introduced in future versions. Monitor API updates for any changes to authentication requirements.

Author

Represents the author of an article.

FieldTypeDescription
idIntIdentifier of the author.
nameStringName of the author.
emailStringEmail address of the author.

Comment

Represents a comment on an article.

FieldTypeDescription
idIntIdentifier of the comment.
authorNameStringName of the comment’s author.
contentStringContent of the comment.
createdAtStringTimestamp when comment was made.

Blog

Represents the blog to which the article belongs.

FieldTypeDescription
idIntIdentifier of the blog.
titleStringTitle of the blog.
handleStringHandle (slug) of the blog.

Notes

  • The comments field returns only published comments. If comments are disabled for the article, this list will be empty.
  • The commentsCount field reflects the number of published comments.
  • Fields like seoDescription, seoTitle, and seoKeywords are optional and may be null if not set.
  • The accountOwner field indicates if the article’s author is the store owner.
  • Timestamps are returned as ISO 8601 strings.
  • Unpublished articles are visible in design mode only (isPublished field indicates publication status).
Last updated on