Skip to content

Commit 3d233f5

Browse files
committed
add api guide
1 parent 630acd7 commit 3d233f5

1 file changed

Lines changed: 195 additions & 0 deletions

File tree

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
= RESTful Notes API Guide
2+
Baeldung;
3+
:doctype: book
4+
:icons: font
5+
:source-highlighter: highlightjs
6+
:toc: left
7+
:toclevels: 4
8+
:sectlinks:
9+
10+
[[overview]]
11+
= Overview
12+
13+
[[overview-http-verbs]]
14+
== HTTP verbs
15+
16+
RESTful notes tries to adhere as closely as possible to standard HTTP and REST conventions in its
17+
use of HTTP verbs.
18+
19+
|===
20+
| Verb | Usage
21+
22+
| `GET`
23+
| Used to retrieve a resource
24+
25+
| `POST`
26+
| Used to create a new resource
27+
28+
| `PATCH`
29+
| Used to update an existing resource, including partial updates
30+
31+
| `DELETE`
32+
| Used to delete an existing resource
33+
|===
34+
35+
RESTful notes tries to adhere as closely as possible to standard HTTP and REST conventions in its
36+
use of HTTP status codes.
37+
38+
|===
39+
| Status code | Usage
40+
41+
| `200 OK`
42+
| The request completed successfully
43+
44+
| `201 Created`
45+
| A new resource has been created successfully. The resource's URI is available from the response's
46+
`Location` header
47+
48+
| `204 No Content`
49+
| An update to an existing resource has been applied successfully
50+
51+
| `400 Bad Request`
52+
| The request was malformed. The response body will include an error providing further information
53+
54+
| `404 Not Found`
55+
| The requested resource did not exist
56+
|===
57+
58+
[[overview-hypermedia]]
59+
== Hypermedia
60+
61+
RESTful Notes uses hypermedia and resources include links to other resources in their
62+
responses. Responses are in http://stateless.co/hal_specification.html[Hypertext Application
63+
from resource to resource.
64+
Language (HAL)] format. Links can be found beneath the `_links` key. Users of the API should
65+
not create URIs themselves, instead they should use the above-described links to navigate
66+
67+
[[resources]]
68+
= Resources
69+
70+
71+
72+
[[resources-index]]
73+
== Index
74+
75+
The index provides the entry point into the service.
76+
77+
[[resources-index-access]]
78+
=== Accessing the index
79+
80+
A `GET` request is used to access the index
81+
82+
==== Request structure
83+
84+
include::{snippets}/index-example/http-request.adoc[]
85+
86+
==== Example response
87+
88+
include::{snippets}/index-example/http-response.adoc[]
89+
90+
==== CURL request
91+
92+
include::{snippets}/index-example/curl-request.adoc[]
93+
94+
[[resources-index-links]]
95+
==== Links
96+
97+
include::{snippets}/index-example/links.adoc[]
98+
99+
100+
[[resources-CRUD]]
101+
== CRUD REST Service
102+
103+
The CRUD provides the entry point into the service.
104+
105+
[[resources-crud-get]]
106+
=== Accessing the crud GET
107+
108+
A `GET` request is used to access the CRUD read.
109+
110+
==== Request structure
111+
112+
include::{snippets}/crud-get-example/http-request.adoc[]
113+
114+
==== Example response
115+
116+
include::{snippets}/crud-get-example/http-response.adoc[]
117+
118+
==== CURL request
119+
120+
include::{snippets}/crud-get-example/curl-request.adoc[]
121+
122+
[[resources-crud-post]]
123+
=== Accessing the crud POST
124+
125+
A `POST` request is used to access the CRUD create.
126+
127+
==== Request structure
128+
129+
include::{snippets}/crud-create-example/http-request.adoc[]
130+
131+
==== Example response
132+
133+
include::{snippets}/crud-create-example/http-response.adoc[]
134+
135+
==== CURL request
136+
137+
include::{snippets}/crud-create-example/curl-request.adoc[]
138+
139+
[[resources-crud-delete]]
140+
=== Accessing the crud DELETE
141+
142+
A `DELETE` request is used to access the CRUD delete.
143+
144+
==== Request structure
145+
146+
include::{snippets}/crud-delete-example/http-request.adoc[]
147+
148+
==== Path Parameters
149+
include::{snippets}/crud-delete-example/path-parameters.adoc[]
150+
151+
==== Example response
152+
153+
include::{snippets}/crud-delete-example/http-response.adoc[]
154+
155+
==== CURL request
156+
157+
include::{snippets}/crud-delete-example/curl-request.adoc[]
158+
159+
[[resources-crud-patch]]
160+
=== Accessing the crud PATCH
161+
162+
A `PATCH` request is used to access the CRUD update.
163+
164+
==== Request structure
165+
166+
include::{snippets}/crud-patch-example/http-request.adoc[]
167+
168+
==== Example response
169+
170+
include::{snippets}/crud-patch-example/http-response.adoc[]
171+
172+
==== CURL request
173+
174+
include::{snippets}/crud-patch-example/curl-request.adoc[]
175+
176+
[[resources-crud-put]]
177+
=== Accessing the crud PUT
178+
179+
A `PUT` request is used to access the CRUD update.
180+
181+
==== Request structure
182+
183+
include::{snippets}/crud-put-example/http-request.adoc[]
184+
185+
==== Example response
186+
187+
include::{snippets}/crud-put-example/http-response.adoc[]
188+
189+
==== CURL request
190+
191+
include::{snippets}/crud-put-example/curl-request.adoc[]
192+
193+
194+
195+

0 commit comments

Comments
 (0)