Alright... I'm probably the confused one...
If JSON-HAL is aimed at my requirements, how do you create APIs with json-hal that aren't read-only? Do you keep out-of-band docs elsewhere to describe how to write? Or do you only write read-only APIs? Or is there some part of the hal docs that I've missed that describes a protocol for methods other than GET? Forms solve the same problem that links do (discoverability, evolvability, etc), but for the writable-side of the API. I'm all for maximum simplicity, but it's got to be within the context of actually solving the problem. If you have a way of achieving discoverable writability without forms, I've definitely missed it. Throw me a clue. :)
I'd be interested to know how anyone else is solving these issues in writable hypermedia JSON apis as well, especially if they're not using something like forms.
G
To me it seems that html forms could be used in an otherwise json based api. Based on Jon Moore's ideas I have started a demo client which submits html forms and follows rels in json responses https://github.com/dschulten/spring-hateoas-rest-service-sample. Who says an api must be all json? A client can request a preferred format (json) and the server can respond with something else (html), possibly of course something standardized.
I see the need for a client framework which supports a good set of standard media types and is easily extensible to support custom types. The project above explores this possibility, maybe you can grab some ideas there :-)
Best regards,
Dietrich
@glenn, no, nothing is wrong with a json form notation. Siren is trying that, too. It is just that html forms are well defined.
Cheers,
M
Cheers,
M
On Tue, Oct 16, 2012 at 8:20 PM, mca <m...@amundsen.com> wrote:Yes. In your deployment(s), how many different client implementations
> <snip>
>> in these two cases a "form-style" design allows a client to adapt to the
>> runtime modifications within responses w/o the need for human intervention
>> and this can add some positive benefit for systems that frequently change
>> or
>> need to exist over a long period of time.
>
> Right, but the longevity is relative to the complexity of the form..
> most form designs are not capable much more than trivial renaming of
> k/v pairs, which I doubt would afford enough control to last a 'long
> period of time'.
> </snip>
>
> do we've gotten beyond the point of recognizing what i describes is possible
> (since i am actively doing it) and you are saying you don't think it's worth
> it, right?
do you have against those forms? Are you able to share the form
design?
> <snip>What set of SHOULD/MAY-to-MUST changes could a client survive if the
> Ok but what kind of scenarios do forms cover here that are unafforded by
> links?
> </snip>
> I don't understand the Q
control was a form that it could not if the control was a link?
So, in a scenario where a field was required that the client was not
> <snip>
>
> My underlying point here is if the outcome is equivalent then why
> bother with the ceremony of forms? Why make your clients life harder
> than it has to be?
> </snip>
>
> you stated:
>> 3. Add required field
>> (f) Clients, realising they can't complete the form...
> and i offered cases where the "add required field" scenario does not result
> in "they can't complete the form..." that's not "...outcome is equivalent."
currently designed to supply - if the form-driven client came across
this form it would omit the field marked required and make the request
regardless? I have a couple of problems with that:
1. your clients are now undermining the required control to the point
where it is redundant at run time
2. this would result in exactly the same request as the link-driven
approach (i.e. request issued that omits a required field and results
in a 4xx)
Afaict, that actually make the form control even less useful.
On Tue, Oct 16, 2012 at 8:53 PM, mca <m...@amundsen.com> wrote:
> On Tue, Oct 16, 2012 at 3:35 PM, Mike Kelly <mikeke...@gmail.com> wrote:
>> What set of SHOULD/MAY-to-MUST changes could a client survive if theNo. I would just define it as a SHOULD in the first place. That way
>> control was a form that it could not if the control was a link?
>
> **********************
> in the example above, the MUST/MAY is sent in the representation and read at
> runtime. does your link implementation (non-form) support this runtime mod
> of MAY/MUST? if so, how does that work?
> **********************
the client will include the field in the request whenever possible. Do
you have a practical example of a scenario you can cover with this
dynamic runtime MAY-to-MUST, which would not be solved with a SHOULD?
That being the case, why bother with forms? They're more complicated
> finally, note that i am not offering these as examples of how a link-style
> design *fails* to handle these problems. i am offering these examples as
> cases where "form-style" design works based on cases i have experienced.
and they don't gain you any more evolvability (hence why your examples
don't show link-style failing).
Cheers,
M
On Wed, Oct 17, 2012 at 7:29 PM, Glenn Block <glenn...@gmail.com> wrote:You can still make use of local client caches and/or gateway caches
> I am ok with forms as a resource though I think there are pros / cons. On
> the con side, it does require extra http calls to get the form, however it
> is "potentially" cachable. I say potentially because a common practice with
> forms is that they are pre-filled, and if they are secure over HTTPs then
> the web is not going to help you caching wise.
behind your SSL endpoint.
I'm still not clear to who/what forms are supposed to be "more
>
> We can debate on this though. The issue here though is Mike is saying forms
> themselves are not valuable, and I personally don't subscribe to that.
>
self-describing", the developer or the coded client?
Cheers,
M
Darrel
Darrel
M
On Thu, Oct 18, 2012 at 5:53 PM, Glenn Block <glenn...@gmail.com> wrote:Here it is: http://webgun.io
> Curious to see your use case. Fair enough that I have not built a large
> scale application that uses forms where the browser is not involved
Buying what? I'm not selling anything! :)
> However.....the use cases for where I would use forms in a browser seem to
> match up very well with using them in an API. I have a hard time buying what
> you are saying, but I am ready to be wrong.
My position here is just to correct statements that say stuff like this:
"you need forms if you want to do writes in a hypermedia API" -
because it is plain wrong.
and this:
"forms give you more evolvability than links in a m2m hypermedia API"
- because so far there isn't much evidence to support this.
Basically, I don't think people should be given the impression that
hypermedia has to be more complicated than it actually is.
Cheers,
M