hateoas

RESTful API runtime discoverability / HATEOAS client design

こ雲淡風輕ζ 提交于 2019-11-29 18:42:07
For a SaaS startup I'm involved in, I am building both a RESTful web API and a couple of client apps on different platforms that consume it. I think I've got the API figured out, but now I'm turning to the clients. As I've been reading about REST, I see that a key part of REST is discovery , but there seems to be a lot of debate between two different interpretations of what discovery really means: Developer discovery : The developer hard-codes copious amounts of API details into the client, such as resource URI's, query parameters, supported HTTP methods, and other details that they've

Returned json unexpected, has “links” spelled as “_links” and structure different, in Spring hateoas

匆匆过客 提交于 2019-11-29 18:09:59
问题 As the title says, I have a resource object Product extending ResourceSupport . However, the responses I receive have the property "_links" instead of "links" and have a different structure. { "productId" : 1, "name" : "2", "_links" : { "self" : { "href" : "http://localhost:8080/products/1" } } } Based on the HATEOAS Reference, the expected is: { "productId" : 1, "name" : "2", "links" : [ { "rel" : "self" "href" : "http://localhost:8080/products/1" } ] } Was this intended? Is there a way to

Multiple converters with Retrofit 2

有些话、适合烂在心里 提交于 2019-11-28 18:50:17
I have a HATEOAS (HAL) REST service and managed to talk to it with the code below (using halarious as a conversion engine) but when I try to merge the converters ( stallone and stallone2 ), the app will always pick up the first converter, instead of the one that is appropriate for the response type which of course leads to an error. How could I avoid duplicate retrofits that are only different in a small type detail? public interface Stallone { @GET("/discovery") Call<DiscoveryResponse> discover(); @POST() Call<LoginResponse> login(@Url String url, @Body LoginRequest secret); } public static

Custom response for root request int the Spring REST HATEOAS with both RepositoryRestResource-s and regular controllers

余生长醉 提交于 2019-11-28 17:03:38
Let's say I have two repositories: @RepositoryRestResource(collectionResourceRel = "person", path = "person") public interface PersonRepository extends PagingAndSortingRepository<Person, Long> { List<Person> findByLastName(@Param("name") String name); } and @RepositoryRestResource(collectionResourceRel = "person1", path = "person1") public interface PersonRepository1 extends PagingAndSortingRepository<Person1, Long> { List<Person1> findByLastName(@Param("name") String name); } with one regular controller: @Controller public class HelloController { @RequestMapping("/hello") @ResponseBody public

HATEOAS: absolute or relative URLs?

╄→尐↘猪︶ㄣ 提交于 2019-11-28 16:23:02
问题 In designing a RESTful Web Service using HATEOAS, what are the pros and cons of showing a link as a complete URL ("http://server:port/application/customers/1234") vs. just the path ("/application/customers/1234")? 回答1: There is a subtle conceptual ambiguity when people say "relative uri". By RFC3986's definition, a generic uri contains: URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty foo://example

How should HATEOAS-style links be implemented for RESTful JSON collections?

◇◆丶佛笑我妖孽 提交于 2019-11-28 15:48:07
问题 To keep things simple and to avoid nameing collisions, I've been bundling links in my record resources like this... { id: 211, first_name: 'John', last_name: 'Lock', _links: [ { rel: 'self', href: 'htttp://example.com/people/211' } ] } However, I can't work out how to implement links in collections. I have spent a long time trawling around the web for examples and other than using the not so lean HAL I'm unable to reconcile my problem. [ {id:1,first_name:.....}, {id:2,first_name:.....}, {id:3

HATEOAS: concise description

五迷三道 提交于 2019-11-28 15:16:48
问题 I am trying to get a clear and concise understanding of HATEOAS, and I am by no means an expert WRT REST. (I think I get it though, thanks to this http://www.looah.com/source/view/2284 ). Can anyone suggest an equally enlighenting blog/article WRT HATEOAS? 回答1: The Hypermedia Constraint (formerly known as HATEOAS) is a constraint that is used to provide direction to the user-agent. By including links in returned representations, the server can remove the burden from the user-agent of

How useful/important is REST HATEOAS ( maturity level 3)?

ⅰ亾dé卋堺 提交于 2019-11-28 15:00:09
问题 I'm getting involved in a project where some senior team members believe that a REST API has to be HATEOAS compliant and implement all Richardson's maturity levels (http://martinfowler.com/articles/richardsonMaturityModel.html)! AFAIK most REST implementations are not HATEOAS compliant and there should be a good reason why more people aren't doing it. I can think of reasons like added complexity, lack of frameworks (server and client sides), performance concern and... What do you think? Have

Actual examples for HATEOAS (REST-architecture) [closed]

拟墨画扇 提交于 2019-11-28 14:57:26
as everyone may have noticed, there are lot of fake/rudimentary REST-APIs in the wild (which implement a HTTP-API and call it REST without following the hypertext-as-the-engine-of-application-state requirement, which led to the famous rant of Roy T. Fielding , the man who first specified the REST-paradigm). I've been unable to find any practical examples of a truly hypertext driven REST-implementation along with the associated application-specific media-type definitions for the state transitions. Are there any publicly accessible examples of such implementations? Its not an implementation in

RESTful API runtime discoverability / HATEOAS client design

人走茶凉 提交于 2019-11-28 13:27:51
问题 For a SaaS startup I'm involved in, I am building both a RESTful web API and a couple of client apps on different platforms that consume it. I think I've got the API figured out, but now I'm turning to the clients. As I've been reading about REST, I see that a key part of REST is discovery , but there seems to be a lot of debate between two different interpretations of what discovery really means: Developer discovery : The developer hard-codes copious amounts of API details into the client,