Beruflich Dokumente
Kultur Dokumente
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
RPC
XML-RPC
SOAP
Separate
Resources
Level 0
Level 1
HTTP
verbs
Level 2
Hyper
media
Level 3
http://www.crummy.com/writing/speaking/2008-QCon/act3.html
http://martinfowler.com/articles/richardsonMaturityModel.html
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Consistency
HTTP status codes
HTTP verbs
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Uniqueness
Use distinct relations on your links
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
{
"_links" : {
"notes" : {
"href" : "http://localhost:8080/notes"
},
"tags" : {
"href" : "http://localhost:8080/tags"
}
}
}
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Resources
What do they represent?
What input do they accept?
What output do they produce?
10
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Links
Where can you go?
What will you find when you get there?
11
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Cross-cutting concerns
HTTP status codes
HTTP verbs (PUT vs PATCH)
Authentication and authorisation
Rate limiting
12
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
13
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
URIs
14
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
15
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
16
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
17
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
18
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
RESTful API
documentation tools
19
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Swagger
http://swagger.io
martypitt/swagger-springmvc
20
20
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
21
21
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Its URI-centric
22
22
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Its leaky
23
23
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Its huge
Hibernate
!
Swagger
!
25MB
31MB
Spring Boot
Tomcat
24
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
mikekelly/hal-browser
25
25
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
A new alternative
wilkinsona/spring-restdocs
26
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Write as much as
possible in a format thats
designed for writing
27
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
28
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
29
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Asciidoctor
Spring MVC Test
Maven or Gradle
wilkinsona/spring-restdocs
30
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
@Test
public void indexExample() throws Exception {
1 this.mockMvc.perform(get("/"))
2 .andExpect(status().isOk()))
.andExpect(jsonPath("_links.notes",
3
is(notNullValue())))
4 .andExpect(jsonPath("_links.tags",
is(notNullValue())))
5 .andDo(document("index-example"));
}
31
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
[source,http]
----
HTTP/1.1 200 OK
Content-Type: application/hal+json
!
{
"_links" : {
"tags" : {
"href" : "http://localhost:8080/tags"
},
"notes" : {
"href" : "http://localhost:8080/notes"
}
}
---32
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
33
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
@Test
public void indexExample() throws Exception {
this.mockMvc.perform(get("/"))
1
.andExpect(status().isOk())
2 .andDo(document("index-example").withLinks(
linkWithRel("notes").description(
3 "The <<resources-notes,Notes resource>>"),
linkWithRel("tags").description(
4
"The <<resources-tags,Tags resource>>")));
}
34
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
|===
| Relation | Description
!
| notes
| The <<resources-notes,Notes resource>>
!
| tags
| The <<resources-tags,Tags resource>>
|===
35
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
36
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
37
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a
Thank you
@ankinson
wilkinsona
awilkinson@pivotal.io
38
38
Unless otherwise indicated, these slides are 2013-2015Pivotal Software, Inc. and licensedunder a