How to display a table with filters using HAL-FORMS

Skip to first unread message

Philipp Kühn

May 19, 2022, 11:31:28 AM5/19/22
to HAL Discuss
I developed a framework (RESTworld) which uses HAL and HAL-FORMS and it served me well over the course of the last year. Read more here if you want: RESTworld framework for HAL and HAL-Forms (

However I'm still using HAL with _embedded resources to display lists (as a table) which the user can search in and then click on an entry to get to the "edit" page of that resource.
This design has the flaw that I don't know the types of the different columns and therefore have to do a best guess when creating the different filters for the colums (text, number, date, ...)..

I would like to use HAL-FORMS in some kind to display the table and know which filters I should render for the different columns, but I'm not sure how to best represent a list with filters using HAL-Forms.

Two possible implementations come to my mind:
1. Combine a form-template and _embedded resources in one response. 
The form would have all the columns as properties. My fear here is that I'm creating a too tight coupling between the API and the UI because the UI would need to know that for these lists, it needs to render the form differently than on an "edit" page.

2. Using one form-template that has a list of nested templates.
I'm already using a custom property type "collection" to represent nested resources in forms. However this would mean that I need to repeat the attributes for every entry in the list, while the UI only needs this one time, as they are all the same for each entry.

Is there any good example or hints for how to use HAL-FORMS to render a table with filters out of a list of resources?



Jul 18, 2022, 12:10:10 PM7/18/22
to HAL Discuss

I think a table view with filters can be considered as a form (applying a filter could mean making a request), so you define a template that has your filters as properties.
Possible values for a given filter (property) can be represented using the options element.
Reply all
Reply to author
0 new messages