Shopify API – Article

top

Receive a list of all Articles

Get a list of all articles from a certain blog

Available URL Query parameters:

  • limit — Amount of results (default: 50) (maximum: 250)
  • page — Page to show (default: 1)
  • since_id — Restrict results to after the specified ID
  • created_at_min — Show articles created after date (format: 2008-01-01 03:00)
  • created_at_max — Show articles created before date (format: 2008-01-01 03:00)
  • updated_at_min — Show articles last updated after date (format: 2008-01-01 03:00)
  • updated_at_max — Show articles last updated before date (format: 2008-01-01 03:00)
  • published_at_min — Show articles published after date (format: 2008-01-01 03:00)
  • published_at_max — Show articles published before date (format: 2008-01-01 03:00)
  • published_status
    • published - Show only published articles
    • unpublished - Show only unpublished articles
    • any - Show all articles (default)
  • fields — comma-separated list of fields to include in the response
GET /admin/blogs/#{id}/articles.json

Get all the articles

Response

           
HTTP/1.1 200 OK[]
{
  "articles": [
    {
      "author": "John",
      "blog_id": 241253187,
      "body_html": "I have no idea what to write about, but it's going to rock!",
      "created_at": "2008-12-31T19:00:00-05:00",
      "id": 989034056,
      "published_at": null,
      "summary_html": null,
      "title": "Some crazy article I'm coming up with",
      "updated_at": "2009-01-31T19:00:00-05:00",
      "user_id": null,
      "tags": "Mystery"
    },
    {
      "author": "Dennis",
      "blog_id": 241253187,
      "body_html": "<p>Do <em>you</em> have an <strong>IPod</strong> yet?</p>",
      "created_at": "2008-07-31T20:00:00-04:00",
      "id": 134645308,
      "published_at": "2008-07-31T20:00:00-04:00",
      "summary_html": null,
      "title": "get on the train now",
      "updated_at": "2008-07-31T20:00:00-04:00",
      "user_id": 799407056,
      "tags": "Announcing"
    }
  ]
}
GET /admin/blogs/#{id}/articles.json?since_id=134645308

Get all the articles after the specified ID

Response

           
HTTP/1.1 200 OK[]
{
  "articles": [
    {
      "author": "John",
      "blog_id": 241253187,
      "body_html": "I have no idea what to write about, but it's going to rock!",
      "created_at": "2008-12-31T19:00:00-05:00",
      "id": 989034056,
      "published_at": null,
      "summary_html": null,
      "title": "Some crazy article I'm coming up with",
      "updated_at": "2009-01-31T19:00:00-05:00",
      "user_id": null,
      "tags": "Mystery"
    }
  ]
}
top

Receive a count of all Articles

Get a count of all articles from a certain blog

Available URL Query parameters:

  • created_at_min — Count articles created after date (format: 2008-01-01 03:00)
  • created_at_max — Count articles created before date (format: 2008-01-01 03:00)
  • updated_at_min — Count articles last updated after date (format: 2008-01-01 03:00)
  • updated_at_max — Count articles last updated before date (format: 2008-01-01 03:00)
  • published_at_min — Count articles published after date (format: 2008-01-01 03:00)
  • published_at_max — Count articles published before date (format: 2008-01-01 03:00)
  • published_status
    • published - Count only published articles
    • unpublished - Count only unpublished articles
    • any - Count all articles (default)
GET /admin/blogs/#{id}/articles/count.json

Count all a blog’s articles

Response

           
HTTP/1.1 200 OK[]
{
  "count": 2
}
top

Receive a single Article

Get a single article by its ID and the ID of the parent blog

Available URL Query parameters:

  • fields — comma-separated list of fields to include in the response
GET /admin/blogs/#{id}/articles/#{id}.json

Get a single article

Response

           
HTTP/1.1 200 OK[]
{
  "article": {
    "author": "Dennis",
    "blog_id": 241253187,
    "body_html": "<p>Do <em>you</em> have an <strong>IPod</strong> yet?</p>",
    "created_at": "2008-07-31T20:00:00-04:00",
    "id": 134645308,
    "published_at": "2008-07-31T20:00:00-04:00",
    "summary_html": null,
    "title": "get on the train now",
    "updated_at": "2008-07-31T20:00:00-04:00",
    "user_id": 799407056,
    "tags": "Announcing"
  }
}
top

Create a new Article

Create a new article for a blog

POST /admin/blogs/#{id}/articles.json

Create a new article with html markup and upload it to a blog.

Request

           
{
  "article": {
    "title": "My new Article title",
    "author": "John Smith",
    "tags": "This Post, Has Been Tagged",
    "body_html": "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class=\"caps\">REST</span>.</p>",
    "published_at": "Thu Mar 24 15:45:47 UTC 2011"
  }
}      

Response

           
HTTP/1.1 201 Created[]
{
  "article": {
    "author": "John Smith",
    "blog_id": 241253187,
    "body_html": "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class=\"caps\">REST</span>.</p>",
    "created_at": "2012-05-09T14:42:00-04:00",
    "id": 1037139878,
    "published_at": "2011-03-24T11:45:47-04:00",
    "summary_html": null,
    "title": "My new Article title",
    "updated_at": "2012-05-09T14:42:00-04:00",
    "user_id": null,
    "tags": "Has Been Tagged, This Post"
  }
}
POST /admin/blogs/#{id}/articles.json

Create a new, but unpublished article for a blog

Request

           
{
  "article": {
    "title": "My new Article title",
    "author": "John Smith",
    "tags": "This Post, Has Been Tagged",
    "body_html": "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class=\"caps\">REST</span>.</p>",
    "published": false
  }
}      

Response

           
HTTP/1.1 201 Created[]
{
  "article": {
    "author": "John Smith",
    "blog_id": 241253187,
    "body_html": "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class=\"caps\">REST</span>.</p>",
    "created_at": "2012-05-09T14:42:00-04:00",
    "id": 1037139879,
    "published_at": null,
    "summary_html": null,
    "title": "My new Article title",
    "updated_at": "2012-05-09T14:42:00-04:00",
    "user_id": null,
    "tags": "Has Been Tagged, This Post"
  }
}
POST /admin/blogs/#{id}/articles.json

Create an article with a metafield

Request

           
{
  "article": {
    "title": "My new Article title",
    "author": "John Smith",
    "tags": "This Post, Has Been Tagged",
    "body_html": "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class=\"caps\">REST</span>.</p>",
    "published_at": "Thu Mar 24 15:45:47 UTC 2011",
    "metafields": [
      {
        "key": "new",
        "value": "newvalue",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}      

Response

           
HTTP/1.1 201 Created[]
{
  "article": {
    "author": "John Smith",
    "blog_id": 241253187,
    "body_html": "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class=\"caps\">REST</span>.</p>",
    "created_at": "2012-05-09T14:42:00-04:00",
    "id": 1037139880,
    "published_at": "2011-03-24T11:45:47-04:00",
    "summary_html": null,
    "title": "My new Article title",
    "updated_at": "2012-05-09T14:42:00-04:00",
    "user_id": null,
    "tags": "Has Been Tagged, This Post"
  }
}
POST /admin/blogs/#{id}/articles.json

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

Request

           
{
  "article": {}
}      

Response

           
HTTP/1.1 422 Unprocessable Entity[]
{
  "errors": {
    "title": [
      "can't be blank"
    ]
  }
}
top

Modify an existing Article

Update an article

PUT /admin/blogs/#{id}/articles/#{id}.json

Add a metafield to an existing article

Request

           
{
  "article": {
    "id": 134645308,
    "metafields": [
      {
        "key": "new",
        "value": "newvalue",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}      

Response

           
HTTP/1.1 200 OK[]
{
  "article": {
    "author": "Dennis",
    "blog_id": 241253187,
    "body_html": "<p>Do <em>you</em> have an <strong>IPod</strong> yet?</p>",
    "created_at": "2008-07-31T20:00:00-04:00",
    "id": 134645308,
    "published_at": "2008-07-31T20:00:00-04:00",
    "summary_html": null,
    "title": "get on the train now",
    "updated_at": "2008-07-31T20:00:00-04:00",
    "user_id": 799407056,
    "tags": "Announcing"
  }
}
PUT /admin/blogs/#{id}/articles/#{id}.json

Hide a published article by changing the published attribute to false

Request

           
{
  "article": {
    "id": 134645308,
    "published": false
  }
}      

Response

           
HTTP/1.1 200 OK[]
{
  "article": {
    "author": "Dennis",
    "blog_id": 241253187,
    "body_html": "<p>Do <em>you</em> have an <strong>IPod</strong> yet?</p>",
    "created_at": "2008-07-31T20:00:00-04:00",
    "id": 134645308,
    "published_at": null,
    "summary_html": null,
    "title": "get on the train now",
    "updated_at": "2012-05-09T14:42:01-04:00",
    "user_id": 799407056,
    "tags": "Announcing"
  }
}
PUT /admin/blogs/#{id}/articles/#{id}.json

Show a hidden article by changing the published attribute to true

Request

           
{
  "article": {
    "id": 134645308,
    "published": true
  }
}      

Response

           
HTTP/1.1 200 OK[]
{
  "article": {
    "author": "Dennis",
    "blog_id": 241253187,
    "body_html": "<p>Do <em>you</em> have an <strong>IPod</strong> yet?</p>",
    "created_at": "2008-07-31T20:00:00-04:00",
    "id": 134645308,
    "published_at": "2012-05-09T14:42:01-04:00",
    "summary_html": null,
    "title": "get on the train now",
    "updated_at": "2012-05-09T14:42:01-04:00",
    "user_id": 799407056,
    "tags": "Announcing"
  }
}
PUT /admin/blogs/#{id}/articles/#{id}.json

Update an existing article of a blog

Request

           
{
  "article": {
    "id": 134645308,
    "body_html": "<p>Look, I can even update through a web service.</p>",
    "author": "Your name",
    "tags": "Tags, Will Be, Updated",
    "title": "My new Title",
    "published_at": "Thu Mar 24 15:45:47 UTC 2011"
  }
}      

Response

           
HTTP/1.1 200 OK[]
{
  "article": {
    "author": "Your name",
    "blog_id": 241253187,
    "body_html": "<p>Look, I can even update through a web service.</p>",
    "created_at": "2008-07-31T20:00:00-04:00",
    "id": 134645308,
    "published_at": "2011-03-24T11:45:47-04:00",
    "summary_html": null,
    "title": "My new Title",
    "updated_at": "2012-05-09T14:42:01-04:00",
    "user_id": null,
    "tags": "Tags, Updated, Will Be"
  }
}
top

Remove a Article from the database

Delete an article of a blog

DELETE /admin/blogs/#{id}/articles/#{id}.json

Remove an existing article from a blog

Response

           
HTTP/1.1 200 OK[]
{}
Last updated on 09 May 2012.