hypermedia

what is hypermedia , hypermedia controls, hypermedia formats

你离开我真会死。 提交于 2019-12-18 09:59:33
问题 I'm currently reading "Rest in practice" book . I'm unable to understand the following terminology Hypermedia , hypermedia format, hypermedia controls, Domain application protocol. The author was suggesting need for domain specific hypermedia format. I could hardly understand those. I googled these terms but couldnt find a right answer. Can anyone explain these terminologies and why we need domain specific hypermedia formats instead of application/xml ? 回答1: Hypermedia = the fact that client

Hypermedia links in Swagger UI using Springfox

☆樱花仙子☆ 提交于 2019-12-13 02:36:16
问题 I'm building a RESTful API, using spring-hateoas library to implement hypermedia. The response of my endpoints is application/hal+json (My DTO extends ResourceSupport). I'm using Swagger to document the endpoints, and using Springfox to autogenerate the swagger-ui. The problem is, that the generated documentation is not correct. As a request for a POST endpoint, the UI is setting the _links section from my DTO as part of the payload, so this is what I see I should send as a parameter for my

HATEOAS and links/actions

江枫思渺然 提交于 2019-12-11 04:46:55
问题 I'm trying to wrap my head around how to (and if to) implement HATEOAS in my api. I like one of the concept of feeding the client only actions that are appropriate in the current situation. However I'm not sure if I'm implementing this idea correctly. Let's say I have a resource type order with a status that can be changed, it can have different statuses ( processing , accepted , declined , expired , successful). Should I then create the following json object: { ... "links": { "accept": "http

Is it correct that Jersey does not support declarative hyperlinking in nested resources?

非 Y 不嫁゛ 提交于 2019-12-10 17:35:45
问题 public class Widget { @Ref(resource=WidgetResource.class) URI url; ... public URI getUrl() { return url; } public Wonkle getWonkle() { return wonkle; } } public class Wonkle { @Ref(resource=WonkleResource.class) URI url; public URI getUrl() { return url; } ... } The JSON representation of the the Wonkle type has a url attribute with an appropriate value. However, when the Wonkle is used as a nested attribute in the Widget type, its url attribute has a null value. Am I doing something

What is the importance of the self link in hypermedia APIs?

廉价感情. 提交于 2019-12-06 18:45:08
问题 All the articles and books I read on REST repeat the importance of adding "self" rel links to your hypermedia responses but they're all light on the reasons and use cases. Why should you add a self link and how is it useful? 回答1: The main reason is that clients (and even some servers) do not store the location of a representation with the representation. For example, if you wget http://.../foo.json , the representation will be saved to disk, but the URI at which it was fetched will not be. If

What is the importance of the self link in hypermedia APIs?

我们两清 提交于 2019-12-04 22:42:55
All the articles and books I read on REST repeat the importance of adding "self" rel links to your hypermedia responses but they're all light on the reasons and use cases. Why should you add a self link and how is it useful? fumanchu The main reason is that clients (and even some servers) do not store the location of a representation with the representation. For example, if you wget http://.../foo.json , the representation will be saved to disk, but the URI at which it was fetched will not be. If there is no "self" link embedded in the representation, this causes two problems: Relative links

Generating Hypermedia links in a Web API

假装没事ソ 提交于 2019-12-03 05:47:14
问题 I'm curious to know how others have dealt with the issue of generating hypermedia links for their web APIs? Specifically, I'm using ASP.NET Web API, and am torn between having operations return hypermedia-related types, or returning the resource itself, and having the hypermedia stuff happen later in the pipeline. That is, do people tend to do things like: public Resource<Order> GetOrder(int id) { return new Resource<Order>() { Content = new Order(), Links = new LinkCollection<Order>() { new

Generating Hypermedia links in a Web API

徘徊边缘 提交于 2019-12-02 19:07:45
I'm curious to know how others have dealt with the issue of generating hypermedia links for their web APIs? Specifically, I'm using ASP.NET Web API, and am torn between having operations return hypermedia-related types, or returning the resource itself, and having the hypermedia stuff happen later in the pipeline. That is, do people tend to do things like: public Resource<Order> GetOrder(int id) { return new Resource<Order>() { Content = new Order(), Links = new LinkCollection<Order>() { new AddOrderLink(), new UpdateOrderLink()} } Or something more like public Order GetOrder(int id) { return

Optionally disable HATEOAS format in Spring Data Rest

自古美人都是妖i 提交于 2019-11-30 18:02:05
So let's say I have an existing application that has two endpoints /people and /pants. Calling GET /people returns: [ { "name":"john", "age":37, "pants":[ { "color":"green", "brand":"levis", "size":"medium" }, { "color":"indigo", "brand":"jncos", "size":"medium-with-huge-legs" } ] }, { "name":"june", "age":23, "pants":[ { "color":"pink", "brand":"gap", "size":"small" } ] } ] If i were to use Spring Data Rest and call GET /person i'd receive something like: { "_links":{ "next":{ "href":"http://myapp.com/people?page=1&size=20" }, "self":{ "href":"http://myapp.com/people{&page,size,sort}",

Java Jersey Declarative Hyperlinking @Ref Annotation Use

人走茶凉 提交于 2019-11-30 15:13:36
问题 I have been trying to expand upon the example provided in Chapter 6 (Declarative Hyperlinking) of the Jersey 1.12 documentation but appear to have hit a wall with regard to the use of the @Ref annotation. My code is as follows: @Path("/offerings/{offeringId}/widgets") @Produces(MediaType.APPLICATION_JSON) public class WidgetsResource { @GET @Path("/{widgetId}") public Response get(@PathParam("offeringId") String offeringId, @PathParam("widgetId") String widgetId) { Widgets widgets = new