HTTP Verbs
This application tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP verbs.
Verb | Usage |
---|---|
|
Used to retrieve resource(s). |
|
Used to create a new resource or execute and action. |
|
Used to update an existing resource. |
|
Used to delete a resource. |
HTTP Status Codes
This application tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP status codes.
Status code | Usage |
---|---|
|
The request completed successfully. |
|
A new resource has been created successfully.. |
|
The request completed successfully, but there is no content included in the response. |
|
The request was malformed. The response body will include an error providing further information. |
|
The request requires authentication. Only basic authentication is currently supported. |
|
The request is authenticated but the authenticated user is not authorized to use the targeted resource. |
|
The requested resource did not exist. |
HATEOAS
The REST API uses HATEOAS to include links to further resources or actions using hypermedia links.
Resources
Books
Creating a new Book
In order to create a book, the consumer needs to provide an isbn
number, a
a title
and a description
for the new book and POST
them to /books
.
This will create a new book in the library’s collection.
Curl request
$ curl 'http://localhost:9090/books' -i -X POST \
-H 'Content-Type: application/json' \
-d '{
"identifier" : null,
"isbn" : "1234567890123",
"title" : "title",
"description" : "description",
"authors" : [ "author" ],
"borrowedByUser" : null,
"links" : [ ]
}'
HTTP request
POST /books HTTP/1.1
Content-Type: application/json
Content-Length: 179
Host: localhost:9090
{
"identifier" : null,
"isbn" : "1234567890123",
"title" : "title",
"description" : "description",
"authors" : [ "author" ],
"borrowedByUser" : null,
"links" : [ ]
}
HTTPie request
$ echo '{
"identifier" : null,
"isbn" : "1234567890123",
"title" : "title",
"description" : "description",
"authors" : [ "author" ],
"borrowedByUser" : null,
"links" : [ ]
}' | http POST 'http://localhost:9090/books' \
'Content-Type:application/json'
HTTP response
HTTP/1.1 201 Created
Location: http://localhost:9090/books/1244d411-adc4-4efe-a5d5-2a0d9b314961
Content-Type: application/hal+json
Content-Length: 604
{
"identifier" : "1244d411-adc4-4efe-a5d5-2a0d9b314961",
"isbn" : "1234567890123",
"title" : "title",
"description" : "description",
"authors" : [ "author" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/books/1244d411-adc4-4efe-a5d5-2a0d9b314961"
},
"borrow" : {
"href" : "http://localhost:9090/books/1244d411-adc4-4efe-a5d5-2a0d9b314961/borrow/{userIdentifier}",
"templated" : true
},
"return" : {
"href" : "http://localhost:9090/books/1244d411-adc4-4efe-a5d5-2a0d9b314961/return/{userIdentifier}",
"templated" : true
}
}
}
Update an existing Book
In order to update a book, the consumer needs to provide an isbn
number, a
a title
and a description
for the new book and PUT
them to /books/{identifier}
.
This will update an existing book in the library’s collection.
Curl request
$ curl 'http://localhost:9090/books/02c3d1fb-ca32-46bd-818f-704012b3fe9c' -i -X PUT \
-H 'Content-Type: application/json' \
-d '{
"identifier" : null,
"isbn" : "1234567890123",
"title" : "title",
"description" : "description",
"authors" : [ "author" ],
"borrowedByUser" : null,
"links" : [ ]
}'
HTTP request
PUT /books/02c3d1fb-ca32-46bd-818f-704012b3fe9c HTTP/1.1
Content-Type: application/json
Content-Length: 179
Host: localhost:9090
{
"identifier" : null,
"isbn" : "1234567890123",
"title" : "title",
"description" : "description",
"authors" : [ "author" ],
"borrowedByUser" : null,
"links" : [ ]
}
HTTPie request
$ echo '{
"identifier" : null,
"isbn" : "1234567890123",
"title" : "title",
"description" : "description",
"authors" : [ "author" ],
"borrowedByUser" : null,
"links" : [ ]
}' | http PUT 'http://localhost:9090/books/02c3d1fb-ca32-46bd-818f-704012b3fe9c' \
'Content-Type:application/json'
HTTP response
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 604
{
"identifier" : "02c3d1fb-ca32-46bd-818f-704012b3fe9c",
"isbn" : "1234567890123",
"title" : "title",
"description" : "description",
"authors" : [ "author" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/books/02c3d1fb-ca32-46bd-818f-704012b3fe9c"
},
"borrow" : {
"href" : "http://localhost:9090/books/02c3d1fb-ca32-46bd-818f-704012b3fe9c/borrow/{userIdentifier}",
"templated" : true
},
"return" : {
"href" : "http://localhost:9090/books/02c3d1fb-ca32-46bd-818f-704012b3fe9c/return/{userIdentifier}",
"templated" : true
}
}
}
Listing all existing Books
All existing books of the library’s collection can be retrieved with a GET
request on the /books
resource.
Curl request
$ curl 'http://localhost:9090/books' -i -X GET
HTTPie request
$ http GET 'http://localhost:9090/books'
HTTP request
GET /books HTTP/1.1
Host: localhost:9090
HTTP response
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 5321
{
"_links" : {
"self" : {
"href" : "http://localhost:9090/books"
}
},
"books" : [ {
"identifier" : "f9bf70d6-e56d-4cab-be6b-294cd05f599f",
"isbn" : "9780132350884",
"title" : "Clean Code",
"description" : "Even bad code can function. But if code isn’t clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesn’t have to be that way. Noted software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship . Martin has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code “on the fly” into a book that will instill within you the values of a software craftsman and make you a better programmer—but only if you work at it.",
"authors" : [ "Bob C. Martin" ],
"borrowedByUser" : {
"identifier" : "c47641ee-e63c-4c13-8cd2-1c2490aee0b3",
"firstName" : "Bruce",
"lastName" : "Wayne",
"email" : "bruce.wayne@example.com",
"roles" : [ "LIBRARY_USER" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/c47641ee-e63c-4c13-8cd2-1c2490aee0b3"
}
}
},
"_links" : {
"self" : {
"href" : "http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f"
},
"borrow" : {
"href" : "http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f/borrow/{userIdentifier}",
"templated" : true
},
"return" : {
"href" : "http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f/return/{userIdentifier}",
"templated" : true
}
}
}, {
"identifier" : "3038627d-627e-448d-8422-0a5705c9e8f1",
"isbn" : "9781449374648",
"title" : "Cloud Native Java",
"description" : "What separates the traditional enterprise from the likes of Amazon, Netflix, and Etsy? Those companies have refined the art of cloud native development to maintain their competitive edge and stay well ahead of the competition. This practical guide shows Java\\/JVM developers how to build better software, faster, using Spring Boot, Spring Cloud, and Cloud Foundry.",
"authors" : [ "Kenny Bastiani", "Josh Long" ],
"borrowedByUser" : {
"identifier" : "69c10574-9064-40e4-85bd-5c68547f3f48",
"firstName" : "Bruce",
"lastName" : "Banner",
"email" : "bruce.banner@example.com",
"roles" : [ "LIBRARY_USER" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/69c10574-9064-40e4-85bd-5c68547f3f48"
}
}
},
"_links" : {
"self" : {
"href" : "http://localhost:9090/books/3038627d-627e-448d-8422-0a5705c9e8f1"
},
"borrow" : {
"href" : "http://localhost:9090/books/3038627d-627e-448d-8422-0a5705c9e8f1/borrow/{userIdentifier}",
"templated" : true
},
"return" : {
"href" : "http://localhost:9090/books/3038627d-627e-448d-8422-0a5705c9e8f1/return/{userIdentifier}",
"templated" : true
}
}
}, {
"identifier" : "081314cb-4abf-43e5-9b38-7d7261edb10d",
"isbn" : "9781617291203",
"title" : "Spring in Action: Covers Spring 4",
"description" : "Spring in Action, Fourth Edition is a hands\\-on guide to the Spring Framework, updated for version 4. It covers the latest features, tools, and practices including Spring MVC, REST, Security, Web Flow, and more. You\\x26#39;ll move between short snippets and an ongoing example as you learn to build simple and efficient J2EE applications. Author Craig Walls has a special knack for crisp and entertaining examples that zoom in on the features and techniques you really need.",
"authors" : [ "Craig Walls" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/books/081314cb-4abf-43e5-9b38-7d7261edb10d"
},
"borrow" : {
"href" : "http://localhost:9090/books/081314cb-4abf-43e5-9b38-7d7261edb10d/borrow/{userIdentifier}",
"templated" : true
},
"return" : {
"href" : "http://localhost:9090/books/081314cb-4abf-43e5-9b38-7d7261edb10d/return/{userIdentifier}",
"templated" : true
}
}
}, {
"identifier" : "02c3d1fb-ca32-46bd-818f-704012b3fe9c",
"isbn" : "9781942788003",
"title" : "The DevOps Handbook",
"description" : "Wondering if The DevOps Handbook is for you? Authors, Gene Kim, Jez Humble, Patrick Debois and John Willis developed this book for anyone looking to transform their IT organization—especially those who want to make serious changes through the DevOps methodology to increase productivity, profitability and win the marketplace.",
"authors" : [ "Gene Kim", "Patrick Debois", "Jez Humble" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/books/02c3d1fb-ca32-46bd-818f-704012b3fe9c"
},
"borrow" : {
"href" : "http://localhost:9090/books/02c3d1fb-ca32-46bd-818f-704012b3fe9c/borrow/{userIdentifier}",
"templated" : true
},
"return" : {
"href" : "http://localhost:9090/books/02c3d1fb-ca32-46bd-818f-704012b3fe9c/return/{userIdentifier}",
"templated" : true
}
}
} ]
}
Getting a Book
An existing book of the library’s collection can be retrieved with a GET
request on the book’s /books/{identifier}
resource.
Curl request
$ curl 'http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f' -i -X GET
HTTPie request
$ http GET 'http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f'
HTTP request
GET /books/f9bf70d6-e56d-4cab-be6b-294cd05f599f HTTP/1.1
Host: localhost:9090
HTTP response
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 1598
{
"identifier" : "f9bf70d6-e56d-4cab-be6b-294cd05f599f",
"isbn" : "9780132350884",
"title" : "Clean Code",
"description" : "Even bad code can function. But if code isn’t clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesn’t have to be that way. Noted software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship . Martin has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code “on the fly” into a book that will instill within you the values of a software craftsman and make you a better programmer—but only if you work at it.",
"authors" : [ "Bob C. Martin" ],
"borrowedByUser" : {
"identifier" : "c47641ee-e63c-4c13-8cd2-1c2490aee0b3",
"firstName" : "Bruce",
"lastName" : "Wayne",
"email" : "bruce.wayne@example.com",
"roles" : [ "LIBRARY_USER" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/c47641ee-e63c-4c13-8cd2-1c2490aee0b3"
}
}
},
"_links" : {
"self" : {
"href" : "http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f"
},
"borrow" : {
"href" : "http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f/borrow/{userIdentifier}",
"templated" : true
},
"return" : {
"href" : "http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f/return/{userIdentifier}",
"templated" : true
}
}
}
Borrowing a Book
In order to borrow a book it has to (1) exist and (2) not already be borrowed
by someone else. A book can be borrowed by providing a borrower
as part
of a POST
request on the /books/{identifier}/borrow
action resource:
Curl request
$ curl 'http://localhost:9090/books/081314cb-4abf-43e5-9b38-7d7261edb10d/borrow/69c10574-9064-40e4-85bd-5c68547f3f48' -i -X POST \
-H 'Content-Type: application/json'
HTTPie request
$ http POST 'http://localhost:9090/books/081314cb-4abf-43e5-9b38-7d7261edb10d/borrow/69c10574-9064-40e4-85bd-5c68547f3f48' \
'Content-Type:application/json'
HTTP request
POST /books/081314cb-4abf-43e5-9b38-7d7261edb10d/borrow/69c10574-9064-40e4-85bd-5c68547f3f48 HTTP/1.1
Content-Type: application/json
Host: localhost:9090
HTTP response
If the book was successfully borrowed, the response would be something like this:
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 1451
{
"identifier" : "081314cb-4abf-43e5-9b38-7d7261edb10d",
"isbn" : "9781617291203",
"title" : "Spring in Action: Covers Spring 4",
"description" : "Spring in Action, Fourth Edition is a hands\\-on guide to the Spring Framework, updated for version 4. It covers the latest features, tools, and practices including Spring MVC, REST, Security, Web Flow, and more. You\\x26#39;ll move between short snippets and an ongoing example as you learn to build simple and efficient J2EE applications. Author Craig Walls has a special knack for crisp and entertaining examples that zoom in on the features and techniques you really need.",
"authors" : [ "Craig Walls" ],
"borrowedByUser" : {
"identifier" : "69c10574-9064-40e4-85bd-5c68547f3f48",
"firstName" : "Bruce",
"lastName" : "Banner",
"email" : "bruce.banner@example.com",
"roles" : [ "LIBRARY_USER" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/69c10574-9064-40e4-85bd-5c68547f3f48"
}
}
},
"_links" : {
"self" : {
"href" : "http://localhost:9090/books/081314cb-4abf-43e5-9b38-7d7261edb10d"
},
"borrow" : {
"href" : "http://localhost:9090/books/081314cb-4abf-43e5-9b38-7d7261edb10d/borrow/{userIdentifier}",
"templated" : true
},
"return" : {
"href" : "http://localhost:9090/books/081314cb-4abf-43e5-9b38-7d7261edb10d/return/{userIdentifier}",
"templated" : true
}
}
}
Returning a Book
In order to return a book it has to (1) exist and (2) be borrowed by the current user.
A book can be returned sending an empty POST
request to the
/books/{identifier}/return
action resource.
Curl request
$ curl 'http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f/return/c47641ee-e63c-4c13-8cd2-1c2490aee0b3' -i -X POST \
-H 'Content-Type: application/json'
HTTPie request
$ http POST 'http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f/return/c47641ee-e63c-4c13-8cd2-1c2490aee0b3' \
'Content-Type:application/json'
HTTP request
POST /books/f9bf70d6-e56d-4cab-be6b-294cd05f599f/return/c47641ee-e63c-4c13-8cd2-1c2490aee0b3 HTTP/1.1
Content-Type: application/json
Host: localhost:9090
HTTP response
If the book was successfully returned, the response would be something like this:
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 1251
{
"identifier" : "f9bf70d6-e56d-4cab-be6b-294cd05f599f",
"isbn" : "9780132350884",
"title" : "Clean Code",
"description" : "Even bad code can function. But if code isn’t clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesn’t have to be that way. Noted software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship . Martin has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code “on the fly” into a book that will instill within you the values of a software craftsman and make you a better programmer—but only if you work at it.",
"authors" : [ "Bob C. Martin" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f"
},
"borrow" : {
"href" : "http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f/borrow/{userIdentifier}",
"templated" : true
},
"return" : {
"href" : "http://localhost:9090/books/f9bf70d6-e56d-4cab-be6b-294cd05f599f/return/{userIdentifier}",
"templated" : true
}
}
}
Deleting a Book
An existing book can be deleted with a DELETE
request on the book’s
/books/{identifier}
resource.
Curl request
$ curl 'http://localhost:9090/books/3038627d-627e-448d-8422-0a5705c9e8f1' -i -X DELETE
HTTPie request
$ http DELETE 'http://localhost:9090/books/3038627d-627e-448d-8422-0a5705c9e8f1'
HTTP request
DELETE /books/3038627d-627e-448d-8422-0a5705c9e8f1 HTTP/1.1
Host: localhost:9090
Users
Creating a new User
In order to create a user, the consumer needs to provide an email address
, first name
and last name
for the new user
and POST
them to /users
.
This will create a new user in the user’s collection.
Curl request
$ curl 'http://localhost:9090/users' -i -X POST \
-H 'Content-Type: application/json' \
-d '{
"identifier" : null,
"firstName" : "Hans",
"lastName" : "Mustermann",
"email" : "test@example.com",
"password" : "password",
"roles" : [ "USER" ]
}'
HTTPie request
$ echo '{
"identifier" : null,
"firstName" : "Hans",
"lastName" : "Mustermann",
"email" : "test@example.com",
"password" : "password",
"roles" : [ "USER" ]
}' | http POST 'http://localhost:9090/users' \
'Content-Type:application/json'
HTTP request
POST /users HTTP/1.1
Content-Type: application/json
Content-Length: 161
Host: localhost:9090
{
"identifier" : null,
"firstName" : "Hans",
"lastName" : "Mustermann",
"email" : "test@example.com",
"password" : "password",
"roles" : [ "USER" ]
}
HTTP response
Successful creation is indicated with a response like this:
HTTP/1.1 201 Created
Location: http://localhost:9090/users/ef57a022-16f3-4932-8cdf-2f9c5d429c0c
Content-Type: application/hal+json
Content-Length: 291
{
"identifier" : "ef57a022-16f3-4932-8cdf-2f9c5d429c0c",
"firstName" : "Hans",
"lastName" : "Mustermann",
"email" : "test@example.com",
"roles" : [ "USER" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/ef57a022-16f3-4932-8cdf-2f9c5d429c0c"
}
}
}
Update an existing User
In order to update an existing user, the consumer needs to provide an email address
, first name
and last name
for the existing user and PUT
them to /users/{identifier}
.
This will update the existing user in the user’s collection.
Curl request
$ curl 'http://localhost:9090/users/0d2c04f1-e25f-41b5-b4cd-3566a081200f' -i -X PUT \
-H 'Content-Type: application/json' \
-d '{
"identifier" : null,
"firstName" : "Hans",
"lastName" : "Mustermann",
"email" : "test@example.com",
"password" : "password",
"roles" : [ "LIBRARY_ADMIN" ]
}'
HTTPie request
$ echo '{
"identifier" : null,
"firstName" : "Hans",
"lastName" : "Mustermann",
"email" : "test@example.com",
"password" : "password",
"roles" : [ "LIBRARY_ADMIN" ]
}' | http PUT 'http://localhost:9090/users/0d2c04f1-e25f-41b5-b4cd-3566a081200f' \
'Content-Type:application/json'
HTTP request
PUT /users/0d2c04f1-e25f-41b5-b4cd-3566a081200f HTTP/1.1
Content-Type: application/json
Content-Length: 170
Host: localhost:9090
{
"identifier" : null,
"firstName" : "Hans",
"lastName" : "Mustermann",
"email" : "test@example.com",
"password" : "password",
"roles" : [ "LIBRARY_ADMIN" ]
}
HTTP response
Successful update is indicated with a response like this:
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 300
{
"identifier" : "0d2c04f1-e25f-41b5-b4cd-3566a081200f",
"firstName" : "Hans",
"lastName" : "Mustermann",
"email" : "test@example.com",
"roles" : [ "LIBRARY_ADMIN" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/0d2c04f1-e25f-41b5-b4cd-3566a081200f"
}
}
}
Listing all existing Users
All existing users of the user’s collection can be retrieved with a GET
request on the /users
resource:
Curl request
$ curl 'http://localhost:9090/users' -i -X GET
HTTPie request
$ http GET 'http://localhost:9090/users'
HTTP request
GET /users HTTP/1.1
Host: localhost:9090
HTTP response
If there are any users the response would look something like this:
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 1729
{
"_links" : {
"self" : {
"href" : "http://localhost:9090/users"
}
},
"users" : [ {
"identifier" : "c47641ee-e63c-4c13-8cd2-1c2490aee0b3",
"firstName" : "Bruce",
"lastName" : "Wayne",
"email" : "bruce.wayne@example.com",
"roles" : [ "LIBRARY_USER" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/c47641ee-e63c-4c13-8cd2-1c2490aee0b3"
}
}
}, {
"identifier" : "69c10574-9064-40e4-85bd-5c68547f3f48",
"firstName" : "Bruce",
"lastName" : "Banner",
"email" : "bruce.banner@example.com",
"roles" : [ "LIBRARY_USER" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/69c10574-9064-40e4-85bd-5c68547f3f48"
}
}
}, {
"identifier" : "40c5ad0d-41f7-494b-8157-33fad16012aa",
"firstName" : "Peter",
"lastName" : "Parker",
"email" : "peter.parker@example.com",
"roles" : [ "LIBRARY_CURATOR" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/40c5ad0d-41f7-494b-8157-33fad16012aa"
}
}
}, {
"identifier" : "0d2c04f1-e25f-41b5-b4cd-3566a081200f",
"firstName" : "Clark",
"lastName" : "Kent",
"email" : "clark.kent@example.com",
"roles" : [ "LIBRARY_ADMIN" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/0d2c04f1-e25f-41b5-b4cd-3566a081200f"
}
}
}, {
"identifier" : "ef57a022-16f3-4932-8cdf-2f9c5d429c0c",
"firstName" : "Hans",
"lastName" : "Mustermann",
"email" : "test@example.com",
"roles" : [ "USER" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/ef57a022-16f3-4932-8cdf-2f9c5d429c0c"
}
}
} ]
}
Getting a User
An existing user of the user’s collection can be retrieved with a GET
request on the user’s /users/{identifier}
resource:
Curl request
$ curl 'http://localhost:9090/users/c47641ee-e63c-4c13-8cd2-1c2490aee0b3' -i -X GET
HTTPie request
$ http GET 'http://localhost:9090/users/c47641ee-e63c-4c13-8cd2-1c2490aee0b3'
HTTP request
GET /users/c47641ee-e63c-4c13-8cd2-1c2490aee0b3 HTTP/1.1
Host: localhost:9090
HTTP response
The response contains an available user like this:
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 302
{
"identifier" : "c47641ee-e63c-4c13-8cd2-1c2490aee0b3",
"firstName" : "Bruce",
"lastName" : "Wayne",
"email" : "bruce.wayne@example.com",
"roles" : [ "LIBRARY_USER" ],
"_links" : {
"self" : {
"href" : "http://localhost:9090/users/c47641ee-e63c-4c13-8cd2-1c2490aee0b3"
}
}
}
Deleting a User
An existing user can be deleted with a DELETE
request on the user’s
/users/{identifier}
resource.
Curl request
$ curl 'http://localhost:9090/users/40c5ad0d-41f7-494b-8157-33fad16012aa' -i -X DELETE
HTTPie request
$ http DELETE 'http://localhost:9090/users/40c5ad0d-41f7-494b-8157-33fad16012aa'
HTTP request
DELETE /users/40c5ad0d-41f7-494b-8157-33fad16012aa HTTP/1.1
Host: localhost:9090