Skip to content

Latest commit

 

History

History
133 lines (85 loc) · 2.75 KB

unrest.md

File metadata and controls

133 lines (85 loc) · 2.75 KB

REST exercises

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.

References

You may find these references useful:

These websites also provide useful information:

Make someone

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?

Find someone

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?

Bad things

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?

People, people everywhere

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?