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

 
8 thiết bị di động chạy Android 4.1 đáng mua nhất

8 thiết bị di động chạy Android 4.1 đáng mua nhất

Dưới đây là những siêu phẩm di động mà Google xác nhận sẽ được cập nhật phiên bản mới nhất Android 4.1, sự kết hợp nâng cao từ sự tiện dụng và vẻ đẹp của Ice Cream Sandwich, nhằm mang lại một trải nghiệm tìm kiếm hoàn toàn mới không thể bỏ qua.

Password Recovery for Drupal 7

Khôi phục mật khẩu trong Drupal 7

Actually recovering your original password in Drupal 7 is not possible, but resetting one is possible and we're going to show you how to do it.

Security Vulnerabilities Affect Your Dev Sites Too | mydropwizard.com

Security Vulnerabilities Affect Your Dev Sites Too | mydropwizard.com

Due to the nature of the vulnerability, from the largest of enterprise applications to the smallest of brochure or hobbyist site builds, all Drupal sites were affected.

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

 

Diet con trung