Tính năng REST Export trong Drupal 8 View

Tính năng REST Export trong Drupal 8 View

As we all are working very hard for upcoming major release I am feeling excited to write this. This blog is all about REST Export feature of Drupal 8’ view. Let me first brief you about what is the REST api and than I will explain you how REST Export is important for building custom REST api for your Drupal 8.

REST (Representational State Transfer) is a web service architecture to expose your resources to outer world. It follows http architecture to expose the resources of your web site i.e you have GET, POST, PATCH,DELETE etc methods to manipulate resources with out web interface. In context to Drupal , a node will have GET method that will require node id and it will return you details related to that node in XML, JSON or HAL + JSON format. If you have ever used REST api for some famous web services like twitter, facebook then you will find those API very well defined for example  GET on /status will give you current status details and GET on /status/comments will give you comments posted on your current status. In context to Drupal we should get node details with GET on  /node/{id} and comments on particular node with GET on /node/{id}/comments. In Drupal 8 we have first REST endpoint but we don’t have second. Drupal has opt for different approach. In Drupal you can use contextual filters on view to filter content as per your parameters passed in URL . The same concept we can applies to REST Export . We can attach a REST Export to a view that only show comments with contextual filter with nodeID as parameter. So the rest export will return XML or JSON for comments related to particular node.

Here is a screenshot for it.

Tính năng REST Export trong Drupal 8 View

We can use REST Export with taxonomy_terms for particular vocabulary as parameter. This concept will make Drupal 8 REST api robust and it also provides good example where view modules and REST module works to gather to provide developer flexibility to develop custom REST api for their Drupal site.

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Khanh Hoang

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Đánh giá các CMS Drupal, Joomla, WordPress

Đánh giá chất lượng các CMS Drupal, Joomla, WordPress

Trên thế giới có hàng ngàn các CMS mã nguồn mở miễn phí, nhưng nổi trội hơn cả là 03 CMS: Joomla, Drupal và WordPress. Sau đây là những đánh giá nhận xét về 3 CMS này.

Khóa học Drupal 60 ngày từ số zero với Acquia Lightning

Khóa học Drupal 60 ngày từ số zero với Acquia Lightning

To build great sites and digital experiences, you need easy-to-use tools for rapid development, simple page building, drag-and-drop widgets for rich media and content

Create Awesome Cover Photo For Facebook Timeline Profile

Create Awesome Cover Photo For Facebook Timeline Profile

Facebook Timeline is one of the newest feature launched by Facebook recently with lots of new changes, Facebook cover photo is one of them.

Công ty diệt chuột T&C

 

Diet con trung