The goal of these exercises is for you to use a number of provided HTTP endpoints and determine what is "not REST" about them, or what could otherwise be improved. You can use Postman (or your favorite HTTP client) to make the requests.
You may find these references useful:
- HTTP Method Definitions (RFC 2616)
- HTTP Status Code Definitions (RFC 2616)
- HTTP Header Field Definitions (RFC 2616)
- Uniform Resource Locator (URL)
These websites also provide useful information:
The following request allows you to create a person:
POST /unrest/people/create HTTP/1.1
Content-Type: application/json
Location: demo.archioweb.ch
{
"firstName": "John",
"lastName": "Doe",
"age": 20
}
What's not RESTful about the request and/or the response?
Make the following request to retrieve a person:
GET /unrest/person/7 HTTP/1.1
Location: demo.archioweb.ch
Then make the following request to modify the person's first name:
GET /unrest/person/7?updateFirstName=Bob HTTP/1.1
Location: demo.archioweb.ch
What's not RESTful or could be improved in the request and/or the response?
Make the following request to attempt to create a thing:
POST /unrest/things HTTP/1.1
Location: demo.archioweb.ch
{}
Then make the following correct request:
POST /unrest/things HTTP/1.1
Location: demo.archioweb.ch
{
"name": "Some thing"
}
What's not RESTful or could be improved in the responses?
The following request allows you to retrieve a list of people:
GET /unrest/people HTTP/1.1
Location: demo.archioweb.ch
You can then filter this list by first name:
GET /unrest/people/byFirstName/John HTTP/1.1
Location: demo.archioweb.ch
By last name:
GET /unrest/people/byLastName/McDeere HTTP/1.1
Location: demo.archioweb.ch
Or by age:
GET /unrest/people/byAge/35 HTTP/1.1
Location: demo.archioweb.ch
What could be improved in these requests?