Page 2
12 Nov
Admin

Installing Drupal 8 with Restful API

Drupal is a wonderful CMS that is used widely by many people. At regular intervals, Drupal introduces its updated versions. Recently, the new version of Drupal – Drupal 8 was launched. Here, we will discuss how Node.js and Express JS can be implemented and linked to Drupal CMS via a Restful API.

Drupal 8

So, before heading on with this blog; we think that you already are aware with:

  • Drupal
  • JavaScript
  • JSON
  • HTML/CSS

Node.js : It is a web server that can offer JavaScript for a client but it can also run JavaScript on the server itself. The JavaScript here performs the task of PHP. Node.js can be easily installed.

Express JS: Express JS Framework makes it easier to publish websites with Node.js. It provides routing and can be used with dynamic website applications as well as MVC based.

So, first let us understand how Drupal can be installed and configured:

  1. Installing and Configuring Drupal Core: Drupal 8 core contains Restful API that allows you to implement the GETs very quickly. Additional modules are to be written when we are dealing with Drupal 8 and then choose the minimal installation as we only need API as well as some additional modules.

    Installing and Configuring Drupal Core

    Once Drupal 8 is installed; one can first activate Drupal administrative theme in order to get a graphic backend.

    Now, the Toolbar module is to be installed for easier navigation via Drupal backend. The modules field is also needed in order to configure content type.

    And the module “Views UI” defines the restful Web Service.

  2. Unnecessary Blocks: A little clean up is to be performed here. Still, there are two unnecessary blocks at the top of the page: Tools & Administration. These blocks can be removed under admin structure block.
  3. Content type “Blog”: A content type blog must include these fields: Title, Body and Image.

    Define Drupal 8 content type as well as fields. For the blog, an Image field is needed as other required fields and data are already provided by Drupal core.

Configuring Drupal8 Web Service:

Here, the content type is defined and the required Web Service can be created. First create a new view ( Admin/ structure/views/add)

Now, export the “Rest” and make sure to check it. Then give it the name “Blogs JSON export” as well as the URL “blogsexportall”.

Configuring Drupal 8 Rest export View:

Under “Show” choose “Fields” instead of ‘Entity’. The fields required here will be:

  1. Title: Formatted “plain text” will be used with “link to content”.
  2. Authored on: The custom format YMD is to be used as it is the right format for schema.org which will be used in the front end.
  3. Blog Image: Here, large image will be added with the text on the top of the blog with Image Style “None” and “Link image to: nothing”.
  4. Authored on: This will be used for the date of the blog item with the custom format DYM.
  5. Body: It will be used for body text on the blog detail page with all default settings
  6. Authored by: This will be used for the name of blogger with all default settings.
  7. Author image: The author image is to be added at the bottom of the blog with all default settings.
  8. Author signature: The signature of the blogger is to be used with his her name at the bottom of the blog with all default settings.

Wind Up:

This is the minimal sort of Drupal installation done here along with its configuration so that it can have backend where content managers can manage blogs. It subsequently generates data in proper format.

For more such guidelines and updates about Drupal, stay tuned with Softqube Technologies, Drupal web Design India.

contact
Are you looking for real talent for your dream projects?
Inquiry
We will respond you in within 24 hours
Do you have a project in mind?
Let's start your project
Quick Contact
We can give you a fast response via email, phone call or skype.
For business inquiries
Call us on
Let's Skype
Close
Inquire
Let’s make something awesome together!
Drop us a line, or give us a heads up if you’re interested in visiting us.
  • Accepted file types: docx, xlsx, ppt, pdf, jpg, gif, png.
  • 12 + 1 =
  • This field is for validation purposes and should be left unchanged.
100% secure and private