Blog

In addition to an online storefront, Shopify shops come with a built-in blogging engine, allowing a shop to have one or more blogs.

Blog

Shop owners are encouraged to use blogs to:

  • Make announcements
  • Talk about their products in more detail
  • Show off their expertise
  • Connect with their customers and
  • Boost their shop's search engine rankings

Shopify blogs are like most other blogs: a content management system for articles posted in reverse chronological order. Articles can be posted under one or more user-defined categories and tagged with one or more user-defined tags, with an option to allow readers to post comments to articles. An Atom feed is automatically generated for each blog, allowing for syndication. The search functionality built into every shop also searches the text in blog articles.

Blogs are meant to be used as a type of magazine or newsletter for the shop, with content that changes over time. If your shop needs a static page (such as an "About Us" page), we recommend that you use a Page instead.

Also see the Article API documentation for managing blog articles.

What can you do with Blog?

The Shopify API lets you do the following with the Blog resource. More detailed versions of these general actions may be available:

Blog Properties

commentable
{ "commentable" : "no" }

Indicates whether readers can post comments to the blog and if comments are moderated or not. Possible values are:

  • no (default): Readers cannot post comments to blog articles.
  • moderate: Readers can post comments to blog articles, but comments must be moderated before they appear.
  • yes: Readers can post comments to blog articles without moderation.

created_at
{ "created_at" : "2012-03-13T16:09:54-04:00" }

The date and time when the blog was created. The API returns this value in ISO 8601 format.

feedburner
{ "feedburner" : null }

Feedburner is a web feed management provider and can be enabled to provide custom RSS feeds for Shopify bloggers. This property will default to blank or "null" unless feedburner is enabled through the shop admin.

feedburner_location
{ "feedburner_location" : null }

URL to the feedburner location for blogs that have enabled feedburner through their store admin.

handle
{ "handle" : "apple-blog" }

A human-friendly unique string for a blog automatically generated from its title. This handle is used by the Liquid templating language to refer to the blog.

id
{ "id" : 241253187 }

A unique numeric identifier for the blog.

metafield
{ "key" : "new" }
{ "value" : "newvalue" }
{ "value_type" : "string" }
{ "namespace" : "global" }

Attaches additional metadata to a store's resources:

  • key (required): Identifier for the metafield (maximum of 30 characters).
  • namespace (required): Container for a set of metadata. Namespaces help distinguish between metadata you created and metadata created by another individual with a similar namespace (maximum of 20 characters).
  • value (required): Information to be stored as metadata.
  • value_type (required): States whether the information in the value is stored as a 'string' or 'integer.'
  • description (optional): Additional information about the metafield.

tags
{ "tags" : "tagged" }

Tags are additional short descriptors formatted as a string of comma-separated values. For example, if an article has three tags: tag1, tag2, tag3.

template_suffix
{ "template_suffix" : null }

States the name of the template a blog is using if it is using an alternate template. If a blog is using the default blog.liquid template, the value returned is "null".

title
{ "title" : "My Blog" }

The title of the blog.

updated_at
{ "updated_at" : "2006-02-01T19:00:00-05:00" }

The date and time when changes were last made to the blog's properties. Note that this is not updated when creating, modifying or deleting articles in the blog. The API returns this value in ISO 8601 format.

Endpoints

GET/admin/blogs.json

Get a list of all blogs

since_id

Restrict results to after the specified ID

handle

Filter by Blog handle

fields

comma-separated list of fields to include in the response

Get all blogs for a shop after a specified ID

GET /admin/blogs.json?since_id=241253187
View Response
HTTP/1.1 200 OK
{
  "blogs": [
    {
      "id": 382285388,
      "handle": "banana-blog",
      "title": "A Gnu Blog",
      "updated_at": "2006-02-02T19:00:00-05:00",
      "commentable": "no",
      "feedburner": null,
      "feedburner_location": null,
      "created_at": "2016-06-20T13:35:06-04:00",
      "template_suffix": null,
      "tags": ""
    },
    {
      "id": 1008414248,
      "handle": "apple-main-blog",
      "title": "Apple main blog",
      "updated_at": "2016-06-20T13:37:37-04:00",
      "commentable": "no",
      "feedburner": null,
      "feedburner_location": null,
      "created_at": "2016-06-20T13:37:37-04:00",
      "template_suffix": null,
      "tags": ""
    }
  ]
}

Get all blogs for a shop

GET /admin/blogs.json
View Response
HTTP/1.1 200 OK
{
  "blogs": [
    {
      "id": 382285388,
      "handle": "banana-blog",
      "title": "A Gnu Blog",
      "updated_at": "2006-02-02T19:00:00-05:00",
      "commentable": "no",
      "feedburner": null,
      "feedburner_location": null,
      "created_at": "2016-06-20T13:35:06-04:00",
      "template_suffix": null,
      "tags": ""
    },
    {
      "id": 241253187,
      "handle": "apple-blog",
      "title": "Mah Blog",
      "updated_at": "2006-02-01T19:00:00-05:00",
      "commentable": "no",
      "feedburner": null,
      "feedburner_location": null,
      "created_at": "2016-06-20T13:35:06-04:00",
      "template_suffix": null,
      "tags": "Announcing, Mystery"
    }
  ]
}
GET/admin/blogs/count.json

Get a count of all blogs

Get all blogs for a shop

GET /admin/blogs/count.json
View Response
HTTP/1.1 200 OK
{
  "count": 2
}
GET/admin/blogs/241253187.json

Get a single blog by its ID

fields

comma-separated list of fields to include in the response

Get a single blog

GET /admin/blogs/#{id}.json
View Response
HTTP/1.1 200 OK
{
  "blog": {
    "id": 241253187,
    "handle": "apple-blog",
    "title": "Mah Blog",
    "updated_at": "2006-02-01T19:00:00-05:00",
    "commentable": "no",
    "feedburner": null,
    "feedburner_location": null,
    "created_at": "2016-06-20T13:35:06-04:00",
    "template_suffix": null,
    "tags": "Announcing, Mystery"
  }
}
POST/admin/blogs.json

Create a new blog

Trying to create a blog without a title will return an error

POST /admin/blogs.json
{
  "blog": {
    "body": "foobar"
  }
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
  "errors": {
    "title": [
      "can't be blank"
    ]
  }
}

Create a new empty blog with a metafield

POST /admin/blogs.json
{
  "blog": {
    "title": "Apple main blog",
    "metafields": [
      {
        "key": "new",
        "value": "newvalue",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}
View Response
HTTP/1.1 201 Created
{
  "blog": {
    "id": 1008414249,
    "handle": "apple-main-blog",
    "title": "Apple main blog",
    "updated_at": "2016-06-20T13:37:38-04:00",
    "commentable": "no",
    "feedburner": null,
    "feedburner_location": null,
    "created_at": "2016-06-20T13:37:38-04:00",
    "template_suffix": null,
    "tags": ""
  }
}

Create a new empty blog

POST /admin/blogs.json
{
  "blog": {
    "title": "Apple main blog"
  }
}
View Response
HTTP/1.1 201 Created
{
  "blog": {
    "id": 1008414251,
    "handle": "apple-main-blog",
    "title": "Apple main blog",
    "updated_at": "2016-06-20T13:37:39-04:00",
    "commentable": "no",
    "feedburner": null,
    "feedburner_location": null,
    "created_at": "2016-06-20T13:37:39-04:00",
    "template_suffix": null,
    "tags": ""
  }
}
PUT/admin/blogs/241253187.json

Update a blog

Add a metafield to an existing blog

PUT /admin/blogs/#{id}.json
{
  "blog": {
    "id": 241253187,
    "metafields": [
      {
        "key": "new",
        "value": "newvalue",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}
View Response
HTTP/1.1 200 OK
{
  "blog": {
    "id": 241253187,
    "handle": "apple-blog",
    "title": "Mah Blog",
    "updated_at": "2016-06-20T13:37:37-04:00",
    "commentable": "no",
    "feedburner": null,
    "feedburner_location": null,
    "created_at": "2016-06-20T13:35:06-04:00",
    "template_suffix": null,
    "tags": "Announcing, Mystery"
  }
}

Update an existing blog title

PUT /admin/blogs/#{id}.json
{
  "blog": {
    "id": 241253187,
    "title": "IPod Updates"
  }
}
View Response
HTTP/1.1 200 OK
{
  "blog": {
    "id": 241253187,
    "handle": "apple-blog",
    "title": "IPod Updates",
    "updated_at": "2016-06-20T13:37:39-04:00",
    "commentable": "no",
    "feedburner": null,
    "feedburner_location": null,
    "created_at": "2016-06-20T13:35:06-04:00",
    "template_suffix": null,
    "tags": "Announcing, Mystery"
  }
}

Update an existing blog title and handle and also activate comments

PUT /admin/blogs/#{id}.json
{
  "blog": {
    "id": 241253187,
    "title": "IPod Updates",
    "handle": "ipod-updates",
    "commentable": "moderate"
  }
}
View Response
HTTP/1.1 200 OK
{
  "blog": {
    "id": 241253187,
    "handle": "ipod-updates",
    "title": "IPod Updates",
    "updated_at": "2016-06-20T13:37:39-04:00",
    "commentable": "moderate",
    "feedburner": null,
    "feedburner_location": null,
    "created_at": "2016-06-20T13:35:06-04:00",
    "template_suffix": null,
    "tags": "Announcing, Mystery"
  }
}
DELETE/admin/blogs/241253187.json

Delete a blog

Remove an existing blog from a shop

DELETE /admin/blogs/#{id}.json
View Response
HTTP/1.1 200 OK
{}