Rest Api in Drupal 8

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Using REST API in Drupal8

• REST stands for Representational State Transfer. REST is a web


standards based architecture and uses HTTP Protocol for data
communication. It revolves around resources where every
component is a resource and a resource is accessed by a common
interface using HTTP standard methods.

• RESTful Web Services are basically REST Architecture based Web


Services. In REST Architecture everything is a resource. RESTful web
services are light weight, highly scalable and maintainable and are
very commonly used to create APIs for web-based applications.
REST API Installation with Drupal8
REST API Installation with Drupal8
REST API Installation with Drupal8
REST API Installation with Drupal8
REST API Installation with Drupal8
REST API Installation with Drupal8
REST API Configration
Steps :
• Create Content type marksdetail
• Add fields with content type
• Name, Subject, Marks
• Create student records for the marksdetail
• Create view for marksdetail
• Edit title (remove the link) and add fields to the view
• Link REST API EXPORT setting and put REST EXPORT PATH
• Represent the data as JSON , XML, HTML etc
• View the data using JSON EDITOR
• Do data manipulation like GET,PUT,UPDATE etc using POSTMAN
REST API Configration
REST API Configuration
REST API Configuration
• Tick the box against “json” since the data will be in json format. Click “Apply”. Finally, save the
view by clicking the "Save" button.
REST API Configration
REST API Configration
Once you saved the view, you can test the end point using any REST
client. Here, we are using "Advanced REST client", an extension of
Google Chrome browser. For installing this, type in
"https://chrome.google.com/webstore/category/apps" in your
Google Chrome browser. Search for "rest client" as shown in the
image below. You will find "Advanced REST client". Click "FREE" to
install the application.
REST API Configration
REST API Configration
REST API Configration
REST API Configration
REST API Configration
REST API Configration
REST API Configration
After installing the rest client, go to the path "chrome://apps/" on
your Google Chrome browser or click the "Apps" icon on the
bookmarks bar of your Google-Chrome browser. Then select the
"Advanced REST client" application.
REST API Configration
REST API Configration
In "Advanced REST client", we need to provide the path of the end
point. Here our path is “http://localhost/rest/export/json/article”.
Select "GET" and click "Send" as shown in the following picture.
REST API Configration
After you send the request, you will get a response "Status Code: 200 - OK", which is a standard
response for successful HTTP requests. This is how the successful response looks:
REST API Configration

You might also like