The world has changed. I think everybody in 2020 ๐Ÿ˜ท understood how important is to be information technology-friendly ๐ŸŒ. Digital transformation for business is the key element to a successful business. If your business does not have API a lot of doors are closed to you. Of course, if you are a Software Developer with experience, making API for small business cases sounds a really easy task. But if we think about small businesses ๐Ÿ’ผ: Confectionery, Farm, etc. To build API for them costs a lot, comparing the income they get. Are in the IT (Information Technology) marked any solutions that small businesses could use to make their API without programming skills? Let`s find out! ๐Ÿ”

Illustration "Digital dilemma" from book "Enterprise API Management" by Luis Weir.

I know it sounds weird API-First (API - Application Programming Interfaces) without programming but it's not a distant future, but it's already the present. As Software Developers we have to find out other ways how to give chance to small businesses to be more technology friendly and spend much less money ๐Ÿ’ธ in making API.

Prerequisites ๐Ÿ”จ

Tools we use for this experiment:

Any solution?

IT market has a solution named Headless CMS (Headless Content Management Systems). In nutshell, Headless CMS is a tool where you build content consists of data, that automatically exposes as API.

A headless content management system, or headless CMS, is a back-end only content management system (CMS) built from the ground up as a content repository that makes content accessible via an API for display on any device.

The term โ€œheadlessโ€ comes from the concept of chopping the โ€œheadโ€ (the front end, i.e. the website) off the โ€œbodyโ€ (the back end, i.e. the content repository).

Choose Headless CMS solution

The market has built a lot of Headless CMS solutions, each of them has different use-cases starting from on-premise and ending with cloud solutions. Before getting in touch with all solutions I defined the criteria to be met by the chosen solution.

My criteria of choose were:

  • simplicity - the solution will understand anybody with fundamental computer skills
  • easy to start - the solution does have simple UX (User Experience) and UI (User Interface), no necessary go through a bunch of wizards and configuration options
  • hosted in the cloud - think when you have a small business, of course, you don`t have any self-hosted servers and skilled IT guys that support that
  • available free plan - at the beginning, you build your business API it is really important to try that before spending real money
  • simple and readable document

After experimenting with a bunch of solutions my preference goes to Hygraph. Hygraph has a really simple user experience and isn`t overstretched with tricky options. The solution is hosted in the cloud โ˜๏ธ and has a quite acceptable free plan for small business cases. That fits my predefined criteria quite well โœ”๏ธ. In the end, Hygraph exposes data as Hygraph API. ๐Ÿš€

The Next Generation GraphQL Content Platform
Hygraph is the next generation GraphQL-Native Federated Content Platform. Integrate all your services with our unique content federation approach and distribute content from anywhere - to anywhere.
Headless CMS Hygraph - https://hygraph.com/ 

Using free plan you get (https://hygraph.com/pricing):

  • 5 users that can access your Hygraph project and work with content
  • 2 languages you can translate your content into
  • 5000 content entries across all your content models, such as a product, article, page, assets, etc
  • 1 million API Calls per month
  • 100 GB total bandwidth of assets you can query a month. Includes images, videos, documents, and other files

Enough information needs to dig into the real-life sample.

Make real-life sample for Bakery ๐Ÿฐ

The business case I choose is Bakery. The bakery has a small product range they would like to sell to the customer. For small businesses, there is an e-commerce platform ๐Ÿช on the market. But to get into that platform you need to have API that platform would consume.

Tried to illustrate the business case how I see the solution โœ๏ธ. Bakery employee works only with user-friendly graphic interface. They define data structure and register products into Headless CMS (Hygraph) by using only a graphic interface. Hygraph exposes API all defined data structures in API endpoint that consumer could query data by using GraphQL queries.

Simple business process visualisation with Headless CMS.

Sign-Up and create a Bakery project

After a successful sign-up process ยฎ๏ธ you have to create the project by filling few details. In the project creation wizard choose a free plan that at starting phase we have not to pay anything. If you have any team members free plan allows you to add additional users to manage the project.

When you completely create a project you will see a quick start guide with four steps. If you complete the first three steps it would be enough. API integration details we leave to the e-commerce platform.

Quick start guide for Hygraph.

Define data structures ๐Ÿ—„๏ธ

To cover Bakery requirements we have to define two data structures Products and Category. The products data structure will store all available products Bakery makes. And category data structure will store groups of products: cakes, cookies, etc.

Using the Schema menu I have defined the following Bakery structures with fields.

Product model

Product model with fields.

Category model

Category model with fields.

It is important to notice that Hygraph has a feature that you can add any validation like required value, unique value, etc. simply check the appropriate checkbox ๐Ÿ—น.

Register Bakery products

The main job in making API we have already done. Now we have to fill in some data and give access to the API endpoint.

For each entry, you have two stages by default draft and published. At Bakery you can register products for the future in a draft state and publish them only when you are ready. Only published entries will be visible for API consumers.

For demonstration purposes, I have registered two categories and few products for each category.

Categories data.
Products data.

Next, we try to query data from our API using Postman. ๐Ÿ”ฌ

Consume Bakery API

Before we start to consume our Bakery API we have to configure access to that. In the Settings (API Access) section there are two options: "Public API"or "Permanent Auth Tokens". As we choose a free plan with few limitations I recommend choosing "Permanent Auth Tokens" ๐Ÿ” to avoid unwanted API requests. Public API options mean that everybody can access API without any security check. "Permanent Auth Tokens" options mean that you generate a unique API access token for each consumer they can use to access your data. Using a permanent authentication token you have full control over consumer accessing API. You can deny access to API at any time.

Generated token consumer puts to the Authorization request header. Decode token you can using https://jwt.io to look at the attributes token contains. Let`s try to query data from Bakery API using Postman.

Bakery API call using Postman.

If everything was configured correctly you have to get in response data. That`s it, now Bakery have API and they can manage data without any programming skills. ๐ŸŽ‰

Of course, Hygraph has much more features than I described. If you would like to dive into more details check their documentation https://hygraph.com/docs.

Summary

As we saw in this post sometimes we do not need to write code to cover business needs related to API. Using Hygraph takes a short amount of time to make API for your business ๐Ÿ’—. When your business has API it gives you a lot of opportunities: chatbots, e-commerce platforms, dynamic ads banners, etc. If you are interested in this topic and you are a tech guy then check Headless CMS Strapi.

Have fun in building API using Headless CMS! โญ

[eof]