API Blog
From Spiffy Stores Knowledge Base
In addition to an online storefront, a Spiffy Store comes with a built-in blogging engine, allowing a store to have one or more blogs.
Store owners are encouraged to use blogs to:
- Make announcements
- Talk about their products in more detail
- Show off their expertise
- Connect with their customers
- Boost their store's search engine rankings
Spiffy Stores blogs are like most other blogs in that they are a content management system for articles posted in reverse chronological order. 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 store, with content that changes over time. If your store needs a static page, such as an "About Us" page, we recommend that you use a Page instead.
Contents
Blog Properties
id | { "id" : 113 } A unique numeric identifier for the blog. |
---|---|
title | { "title": "Latest News" } The title of the blog. |
handle | { "handle": "latest-news" } A unique, human-friendly string for the blog, generated automatically from its title. In online store themes, the Liquid templating language refers to a blog by its handle. |
body | { "body": "" } Not currently used. |
body_html | { "body_html": "" } Not currently used. |
created_at | { "created_at": "2008-07-15T20:00:00-04:00" } The date and time (ISO 8601 format) when the blog was created. |
updated_at | { "updated_at": "2008-07-16T20:00:00-04:00" } The date and time (ISO 8601 format) when the blog was last updated. |
published | { "published" : true } Indicates whether the blog is published and visible to customers. |
Endpoints
GET /api/blogs.json
Retrieve a list of all blogs.
Optional Parameters
limit | Number of results returned. The default is 30, with a maximum of 50 in a single request. |
---|---|
page | The number of the page to return. The number of results per page is set by the limit parameter. If more results are required, then submit the request again, increasing the page number each time.
|
since_id | Limit the results to only include objects which have an id greater than the given value. |
title | Limit the results to only include blogs with the given title. |
handle | Limit the results to only include blogs with the given handle. |
published_status | Limit the results to only include blogs with the given published status ('published' or 'unpublished'). |
created_at_min | Return only the blogs created after the given date and time. Use the format "2014-12-31 12:00". |
created_at_max | Return only the blogs created before the given date and time. Use the format "2014-12-31 12:00". |
updated_at_min | Return only the blogs updated after the given date and time. Use the format "2014-12-31 12:00". |
updated_at_max | Return only the blogs updated before the given date and time. Use the format "2014-12-31 12:00". |
fields | A comma-separated list of fields to return in the response. |
Example Request and Response
GET /api/blogs.json HTTP/1.1 200 OK { "blogs": [ { "id": 248, "title": "Latest News", "handle": "latest-news", "body": "", "body_html": "", "created_at": "2009-11-21T01:42:15.664+11:00", "updated_at": "2015-09-10T12:16:29.619+10:00", "published": true }, ... ] } Examples using filters GET /api/blogs.json?fields=id,title
GET /api/blogs/count.json
Return a count of the number of blogs.
Optional Parameters
since_id | Limit the results to only include objects which have an id greater than the given value. |
---|---|
title | Limit the results to only include blogs with the given title. |
handle | Limit the results to only include blogs with the given handle. |
published_status | Limit the results to only include blogs with the given published status ('published' or 'unpublished'). |
created_at_min | Return only the blogs created after the given date and time. Use the format "2014-12-31 12:00". |
created_at_max | Return only the blogs created before the given date and time. Use the format "2014-12-31 12:00". |
updated_at_min | Return only the blogs updated after the given date and time. Use the format "2014-12-31 12:00". |
updated_at_max | Return only the blogs updated before the given date and time. Use the format "2014-12-31 12:00". |
Example Request and Response
GET /api/blogs/count.json HTTP/1.1 200 OK { "count": 3 }
GET /api/blogs/BLOG_ID.json
Retrieves a single blog by ID.
Optional Parameters
fields | A comma-separated list of fields to return in the response. |
---|
Example Request and Response
GET /api/blogs/248.json HTTP/1.1 200 OK { "blog": { "id": 248, "title": "Latest News", "handle": "latest-news", "body": "", "body_html": "", "created_at": "2009-11-21T01:42:15.664+11:00", "updated_at": "2015-09-10T12:16:29.619+10:00", "published": true } }
GET /api/blogs/BLOG_ID/authors.json
Retrieves all the authors that have contributed to the blog.
Example Request and Response
GET /api/blogs/248/authors.json HTTP/1.1 200 OK { "authors": [ "Bilbo Baggins", "System Admin" ] }
POST /api/blogs.json
Add a blog to the store.
Example Request and Response
POST /api/blogs.json { "blog": { "title": "My Latest Product", "published": true } } HTTP/1.1 201 Created
PUT /api/blogs/BLOG_ID.json
Updates a blog.
Example Request and Response
PUT /api/blogs/248.json { "blog": { "id": 248, "published": false } } HTTP/1.1 200 OK
DELETE /api/blogs/BLOG_ID.json
Deletes a blog and all of its articles from the store.
Example Request and Response
DELETE /api/blogs/248.json HTTP/1.1 200 OK {}