REST API Design

First see this video that I have created, and read the reading that you will find on the Assignments page.

Then come up with a REST API of your own design. Your API does not need to be very complicated, but it must have at least 2 resource types that each have at least 2 attributes, and the resource types must be related in some way.

In the file api_description.txt, give a general description of your API and then describe each supported request. You must have GET operations for each of your resources. You must have at least one POST operation, at least one DELETE operation, and at least one PUT or PATCH operation. You do not have to have these modification operations for all of your resources, there just needs to be at least one of each somewhere.

When describing each HTTP verb and endpoint combination give a general description of the operation, describe any parameters that are needed, and give an example JSON response.

Here is the format I am looking for. This extends the example I started in the video:

GET /dogs

Description:
Get a list of all dogs

Parameters:
None

Example response:
[
  {
    "id": 1,
    "name": "Vienna",
    "age": 8,
    "breed_id": 3,
    "breed": "Dachshund",
    "Owner": "Erin",
    "owner_id": 1
  },
  {
    "id": 2,
    "name": "Harold",
    "age": 10,
    "breed_id": 1,
    "breed": "Basset Hound",
    "owner": "Ben",
    "owner_id": 2
  }
]
  
GET /dogs/:id
  
Description:
Get a single dog by ID

Parameters:
id - the ID of the dog

Example response:
{
  "id": 1,
  "name": "Vienna",
  "age": 8,
  "breed": "Dachshund",
  "breed_id": 3,
  "owner": "Erin",
  "owner_id": 1
}

PATCH /dogs

Description:
Update information about a dog and get the updated information about the dog in
response

Parameters:
id - the ID of the dog
name (optional) - the new name of the dog
age (optional) - the new age of the dog
owner_id (optional) - the ID of the new owner
breed_id (optional) - the ID of the new breed

Example response when supplying the id 1 and new age of 9:
{
  "id": 1,
  "name": "Vienna",
  "age": 9,
  "breed": "Dachshund",
  "breed_id": 3,
  "owner": "Erin",
  "owner_id": 1
}

POST /breeds

Description:
Add a new breed and get the added breed in response

Parameters:
name - the name of the breed

Example response:
{
  "id": 5,
  "name": "Pug"
}

Submission

Push your api_description.txt back to git-keeper.