HAL-FORMS suggested workflow

31 views
Skip to first unread message

Icke Bins

unread,
Dec 4, 2021, 6:43:05 AM12/4/21
to HAL Discuss
Hi,

https://rwcbook.github.io/hal-forms/#_suggested_process_flow_for_hal_forms_documents

describes the suggested WF.

"6.2. Requesting a HAL-FORMS Document": Here a HAL-FORM doc is returned, where the template does not contain the target attribute. 

This way the Client must remember the href from the HAL doc from "6.1. Starting With a Typical HAL Response" and the HAL-FORM is not self contained.

Was this by intent? If so, why?

Thx :)


mca

unread,
Dec 4, 2021, 10:08:59 AM12/4/21
to hal-d...@googlegroups.com
inline...

my client apps don't "remember" the HAL-FORMS URL, they use the URLs in the HAL response. 
 

Was this by intent? If so, why?
The suggested workflow is meant to add FORMS support w/o changing the rules for HAL responses. this way, HAL-FORMS support is backwards compatible w/ standard HAL.
 

Thx :)


--
You received this message because you are subscribed to the Google Groups "HAL Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hal-discuss...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/hal-discuss/4fb069ce-4e3f-43cd-9a1e-cd4124f91e27n%40googlegroups.com.

Icke Bins

unread,
Dec 4, 2021, 3:02:18 PM12/4/21
to HAL Discuss
I do not understand.

The HAL-FORMS doc does not define a target attribute on the default template.
So how to determine the URL where the default templates form has to post to?

{ "_links" : { "self" : { "href" : "http://api.example.org/rels/create" } }, "_templates" : { "default" : { "title" : "Create", "method" : "POST", "contentType" : "application/json", "properties" : [ {"name" : "title", "required" : true, "value" : "", "prompt" : "Title", "regex" : "", "templated" : false}, {"name" : "completed", "required" : false, "value" : "false", "prompt" : "Completed", "regex" : ""} ] } } }

mca

unread,
Dec 4, 2021, 6:17:36 PM12/4/21
to hal-d...@googlegroups.com
Oh. i thought you meant the URL of the FORM. you mean the target URL of the transition (add/update/detete, etc.)

yes - the original design allows for the same form to be used for multiple target URLs (think the URL of each item in a collection). 

and, yes, my client apps _do_ recall the target URL when calling the form. in my implementations HAL-FORMS are "side-loaded" like images, CSS or JavaScript files, etc are in HTML browsers so "remembering" is not costly. 

however, if you prefer, you can use any of the query string values listed in secftion 4 [1] to pass document, source, target, URLs and lots of other information to the server when you call the form.

hope this helps.



Mike Amundsen



Icke Bins

unread,
Dec 5, 2021, 6:37:28 AM12/5/21
to HAL Discuss
Ahh, ok, so  _htarget would solve my problem!
Thx :)

Icke Bins

unread,
Dec 5, 2021, 7:44:09 AM12/5/21
to HAL Discuss

mca

unread,
Dec 5, 2021, 9:43:50 AM12/5/21
to hal-d...@googlegroups.com
yeah - the services i shared with you don't support the optional query string elements. 

there might be other public services that do. 

if you wish, you can clone the nodejs repo and mod the implementation to support one or more query string properties for HAL requests.

happy to follow up here.

cheers.


Mike Amundsen


Reply all
Reply to author
Forward
0 new messages