- From: <tomasz@t-code.pl>
- Date: Sun, 02 Nov 2014 15:40:22 +0000
- To: "Kev Kirkland" <kev@dataunity.org>, public-hydra@w3.org
Hi comments inline October 30 2014 11:35 AM, "Kev Kirkland" <kev@dataunity.org> wrote: > I've been looking at how to edit resources with Hydra. > > I don't think this has been implemented in the demos yet. For example if you go to the events list > demo [1] and choose the PUT operation for one of the events, the form's input boxes are blank > rather than having the current event's details filled in. > > I'm looking to put editing into my AngularJS Hydra client. To fill in the PUT form with the details > of the resource you are editing, do you do a GET request to the form's URL to get the > representation of the item you are editing then use it to populate the input boxes on the form? So > for the events demo would the sequence be: > > find an event to edit (e.g. /hydra/event-api/events/1) > choose the PUT operation for the event > do a GET request to fetch the resource's representation (e.g. GET hydra/event-api/events/1) > I don't understand this order. What does the first step mean? How do you "find an event to edit"? In general RESTful services work by first retrieving a resource representation and then following links or invoking actions. Each subsequent resource retrieved is your application state. That resource's representation together with some metadata (Hydra fulfills that role in our case) lets you decide what will be the next request. So, my point is that typically you would first get the resource and only then discover that a PUT is allowed. Otherwise you are making assumptions. Even if you knew the URI, you don't have enough explicit information required to act upon it. > > use the GET request's data to fill in the input boxes on the PUT form > submit the PUT request (with user's edits) to the url of the event (e.g. > /hydra/event-api/events/1)? > > Thanks, > > Kev > > [1] > http://www.markus-lanthaler.com/hydra/console/?url=http://www.markus-lanthaler.com/hydra/event-api/e > ents/ > > -- www.dataunity.org twitter: @data_unity
Received on Sunday, 2 November 2014 15:41:03 UTC