Create a Blog schema using Flows

Last updated: 03 May 2019

If you want to use a single platform for multiple solutions, Moltin API gives you the ability to use custom data to create a blog and manage your content with some light configuration.


  • Moltin dashboard (you'll need Client ID and Client Secret of your store).
  • Basic understanding of object-oriented programming or JavaScript.


Summary of steps required

  • Create a Flow that will contain your blog object.
  • Create Fields to create blog's building blocks (date, title, blog post entry, fields, etc.).
  • Create Entries to store the actual content (blog posts).
  • Create relationships to organize data and manage the content.
  • Fetch blog content to display and render it according to your needs on your blog site.

Step-by-step walkthrough

Use Flow API (custom data) to create a new resource: a blog object to store blog content you can surface on your website.

1. Get your access token

Get a client_credentials access token to follow along making the API requests outlined below.


2. Create a new custom Flow

Create a custom (non-core) Flow. This Flow is going to power a blog website, and used to store blog content objects.


Make sure to take note of the Flow ID returned (the id field in the response), you'll need this to create relationship between the Flow and its Fields.

3. Create Fields

Fields will be returned when you call the blog object. Repeat this for every blog feature you'd like to include, e.g. blog title, blog date, blog post content, etc. The example below shows how to create fields to store basic blog detail: title.

Each Field must be passed separately.

Populate the field with the Flow ID generated as part of the create (POST) Flow response.


4. Create Entries for a Blog

Entries represent the actual content each Field will contain. Create an Entry for every Field added. In this example, the Title, Date and Content Fields will be a part of the Entry created, as they were all flagged as required.

Using slugs

Slug forms the end part of the URL. Use it to create human-readable and search-engine-friendly URIs for your blog.

Note that the slug used in the URL is case sensitive.


5. Create relationships to organize your data

You can use the Moltin API to manage your content. You would use custom Flows for that. If you have a more robust CMS in mind, we recommend plugging in a third party content management tool, such as Contentful.

First, create Fields related to a Flow to adapt a data model to how you wish to present it on the frontend, e.g. posts per author, posts per category, etc.

To create a relationship, take the Flow you want to relate your Fields to, and use its slug in the URL of the request. Then, specify which Field you wish to relate to in the request body, and repeat it for every Field you wish to relate to this Flow.

When fetching the Flow, it will list all Fields that are related to it.

a) Create a Flow

b) Create related Field

c) Fetch the Flow with all related Fields


6. Fetch Blog content to display

Using the Moltin API, fetch the blog Flow which will now contain the blog post created above. 

Expected outcome

Your blog is now surfaced on your website. The data you've fetched is in JSON format, and you can render it according to your needs directly on your blog site. You can now expand it by adding photo galleries, comments, reviews, etc.