.blog() and .select() to configure the query.
Parameters
When fetching by handle, you must either use
.blog() or pass the blogHandle parameter.Returns
ShopifyArticle | null
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Fetch a single article
openbridge.articles.get(idOrHandle, blogHandle?)
openbridge.articles.get(idOrHandle).blog(blogHandle).select(fields)
.blog() and .select() to configure the query.
| Param | Type | Required | Description |
|---|---|---|---|
idOrHandle | string | Yes | Article handle or Shopify GID |
blogHandle | string | No | Blog handle (required when fetching by article handle) |
.blog() or pass the blogHandle parameter.ShopifyArticle | null
const article = await openbridge.articles.get('my-first-post', 'news')
if (article) {
console.log(article.title)
}
const article = await openbridge.articles
.get('my-first-post')
.blog('news')
const article = await openbridge.articles.get(
'gid://shopify/Article/123456789'
)
const article = await openbridge.articles
.get('gid://shopify/Article/123456789')
.select(['title', 'handle', 'content', 'image', 'author'])
const article = await openbridge.articles.get('non-existent', 'news')
if (!article) {
console.log('Article not found')
}