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

 
Mac OS X Lion bất ngờ tăng trưởng chậm

Mac OS X Lion bất ngờ tăng trưởng chậm

Chỉ mất hai tháng để OS X Lion được cài đặt trong 14% người dùng máy Mac nhưng trong tháng 10 vừa qua lại chỉ tăng 2%.

Complete Review of Latest YouTube Version for Android Phones

Complete Review of Latest YouTube Version for Android Phones

If you own an Android mobile phone, you can get YouTube, the most popular video site in the world.

Hướng dẫn thêm HTML tags vào trong <head> in Drupal 8

Hướng dẫn thêm HTML tags vào trong <head> in Drupal 8

This is done by passing a render array and most of the time you'll use the type 

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

 

Diet con trung