|
|
|
@@ -0,0 +1,153 @@
|
|
|
|
|
= RESTful Notes API Guide
|
|
|
|
|
Baeldung;
|
|
|
|
|
:doctype: book
|
|
|
|
|
:icons: font
|
|
|
|
|
:source-highlighter: highlightjs
|
|
|
|
|
:toc: left
|
|
|
|
|
:toclevels: 4
|
|
|
|
|
:sectlinks:
|
|
|
|
|
|
|
|
|
|
[[overview]]
|
|
|
|
|
= Overview
|
|
|
|
|
|
|
|
|
|
[[overview-http-verbs]]
|
|
|
|
|
== HTTP verbs
|
|
|
|
|
|
|
|
|
|
RESTful notes tries to adhere as closely as possible to standard HTTP and REST conventions in its
|
|
|
|
|
use of HTTP verbs.
|
|
|
|
|
|
|
|
|
|
|===
|
|
|
|
|
| Verb | Usage
|
|
|
|
|
|
|
|
|
|
| `GET`
|
|
|
|
|
| Used to retrieve a resource
|
|
|
|
|
|
|
|
|
|
| `POST`
|
|
|
|
|
| Used to create a new resource
|
|
|
|
|
|
|
|
|
|
| `PUT`
|
|
|
|
|
| Used to update an existing resource
|
|
|
|
|
|
|
|
|
|
| `DELETE`
|
|
|
|
|
| Used to delete an existing resource
|
|
|
|
|
|===
|
|
|
|
|
|
|
|
|
|
RESTful notes tries to adhere as closely as possible to standard HTTP and REST conventions in its
|
|
|
|
|
use of HTTP status codes.
|
|
|
|
|
|
|
|
|
|
|===
|
|
|
|
|
| Status code | Usage
|
|
|
|
|
|
|
|
|
|
| `200 OK`
|
|
|
|
|
| The request completed successfully
|
|
|
|
|
|
|
|
|
|
| `201 Created`
|
|
|
|
|
| A new resource has been created successfully. The resource's URI is available from the response's
|
|
|
|
|
`Location` header
|
|
|
|
|
|
|
|
|
|
| `204 No Content`
|
|
|
|
|
| An update to an existing resource has been applied successfully
|
|
|
|
|
|
|
|
|
|
| `400 Bad Request`
|
|
|
|
|
| The request was malformed. The response body will include an error providing further information
|
|
|
|
|
|
|
|
|
|
| `404 Not Found`
|
|
|
|
|
| The requested resource did not exist
|
|
|
|
|
|===
|
|
|
|
|
|
|
|
|
|
[[overview-hypermedia]]
|
|
|
|
|
== Hypermedia
|
|
|
|
|
|
|
|
|
|
RESTful Notes uses hypermedia and resources include links to other resources in their
|
|
|
|
|
responses. Responses are in http://stateless.co/hal_specification.html[Hypertext Application
|
|
|
|
|
from resource to resource.
|
|
|
|
|
Language (HAL)] format. Links can be found beneath the `_links` key. Users of the API should
|
|
|
|
|
not create URIs themselves, instead they should use the above-described links to navigate
|
|
|
|
|
|
|
|
|
|
[[resources]]
|
|
|
|
|
= Resources
|
|
|
|
|
|
|
|
|
|
[[resources-FOO]]
|
|
|
|
|
== FOO REST Service
|
|
|
|
|
|
|
|
|
|
The FOO provides the entry point into the service.
|
|
|
|
|
|
|
|
|
|
[[resources-foo-get]]
|
|
|
|
|
=== Accessing the foo GET
|
|
|
|
|
|
|
|
|
|
A `GET` request is used to access the foo read.
|
|
|
|
|
|
|
|
|
|
==== Request structure
|
|
|
|
|
|
|
|
|
|
include::{snippets}/getAFoo/http-request.adoc[]
|
|
|
|
|
|
|
|
|
|
==== Path Parameters
|
|
|
|
|
include::{snippets}/getAFoo/path-parameters.adoc[]
|
|
|
|
|
|
|
|
|
|
==== Example response
|
|
|
|
|
|
|
|
|
|
include::{snippets}/getAFoo/http-response.adoc[]
|
|
|
|
|
|
|
|
|
|
==== CURL request
|
|
|
|
|
|
|
|
|
|
include::{snippets}/getAFoo/curl-request.adoc[]
|
|
|
|
|
|
|
|
|
|
[[resources-foo-post]]
|
|
|
|
|
=== Accessing the foo POST
|
|
|
|
|
|
|
|
|
|
A `POST` request is used to access the foo create.
|
|
|
|
|
|
|
|
|
|
==== Request structure
|
|
|
|
|
|
|
|
|
|
include::{snippets}/createFoo/http-request.adoc[]
|
|
|
|
|
|
|
|
|
|
==== Example response
|
|
|
|
|
|
|
|
|
|
include::{snippets}/createFoo/http-response.adoc[]
|
|
|
|
|
|
|
|
|
|
==== CURL request
|
|
|
|
|
|
|
|
|
|
include::{snippets}/createFoo/curl-request.adoc[]
|
|
|
|
|
|
|
|
|
|
[[resources-foo-delete]]
|
|
|
|
|
=== Accessing the foo DELETE
|
|
|
|
|
|
|
|
|
|
A `DELETE` request is used to access the foo delete.
|
|
|
|
|
|
|
|
|
|
==== Request structure
|
|
|
|
|
|
|
|
|
|
include::{snippets}/deleteFoo/http-request.adoc[]
|
|
|
|
|
|
|
|
|
|
==== Path Parameters
|
|
|
|
|
include::{snippets}/deleteFoo/path-parameters.adoc[]
|
|
|
|
|
|
|
|
|
|
==== Example response
|
|
|
|
|
|
|
|
|
|
include::{snippets}/deleteFoo/http-response.adoc[]
|
|
|
|
|
|
|
|
|
|
==== CURL request
|
|
|
|
|
|
|
|
|
|
include::{snippets}/deleteFoo/curl-request.adoc[]
|
|
|
|
|
|
|
|
|
|
[[resources-foo-put]]
|
|
|
|
|
=== Accessing the foo PUT
|
|
|
|
|
|
|
|
|
|
A `PUT` request is used to access the foo update.
|
|
|
|
|
|
|
|
|
|
==== Request structure
|
|
|
|
|
|
|
|
|
|
include::{snippets}/updateFoo/http-request.adoc[]
|
|
|
|
|
|
|
|
|
|
==== Path Parameters
|
|
|
|
|
include::{snippets}/updateFoo/path-parameters.adoc[]
|
|
|
|
|
|
|
|
|
|
==== Example response
|
|
|
|
|
|
|
|
|
|
include::{snippets}/updateFoo/http-response.adoc[]
|
|
|
|
|
|
|
|
|
|
==== CURL request
|
|
|
|
|
|
|
|
|
|
include::{snippets}/updateFoo/curl-request.adoc[]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|