Open brisebois opened 12 years ago
I can't claim to be any sort of expert on HAL or Hypermedia; in this case I'd recommend you post a question on the HAL mailing list: https://groups.google.com/forum/?fromgroups#!forum/hal-discuss
In saying that: My take on it would be that you have two options when you do a POST or a PUT; you can either do a "HTTP 204 No Content" (or "201 Created") with a Location header pointing to the item that was created/edited or you can save the user needing to do the second HTTP request and do a "200 OK" (or "201 Created") with the same body content that they would have gotten by doing the extra HTTP request (hypermedia included).
My repo has an example commit where I switched between those two options at: https://github.com/robdmoore/Hal.PlayAround/commit/0bb1800a858763c2b68704731c29d8508ff6e4b7
@JakeGinnivan: Happy for you to step in and provide your view as well...
Hi,
I recently started looking into HAL and I keep coming up with the same question.
It's great that I'm able to create discoverable APIs using HAL, but I also want to prescribe POST and PUT contracts for the client.
Are there any examples in regards to this? Is this practice discouraged ?
Best regards, Alexandre Brisebois