Routes

Routes to interact with and make changes to the Broadway actors table.

HTTP method Endpoint Function
GET /actors List all actors
GET /actors/{actor-id} View a specific actor
POST /actors Add a new actor
PUT /actors/{actor-id} Update the fields of a specific actor
DELETE /actors/{actor-id} Delete a specific actor

Sample Requests

Get, create, update, or delete an actor with their associated HTTP methods.

Sample list all actors request

Here is the request to list all actors in JSON format:

GET http://localhost:8888/actors

Sample Response

[
  {
    "id": 1,
    "firstName": "Phillipa",
    "lastName": "Soo",
    "dateOfBirth": "01/22/1990",
    "mostRecentShow": "Hamilton",
    "numberOfShows": "1",
    "created_at": "2017-04-04 21:30:02",
    "updated_at": "2017-04-04 21:30:02"
  },
  {
    "id": 2,
    "firstName": "Ben",
    "lastName": "Platt",
    "dateOfBirth": "09/24/1993",
    "mostRecentShow": "Dear Evan Hansen",
    "numberOfShows": "3",
    "created_at": "2017-04-06 21:53:28",
    "updated_at": "2017-04-06 21:53:28"
  }
]

Sample view specific actor request

Here is a sample request to view a specific actor with ID 1:

GET http://localhost:8888/actors/1

Sample Response

{
    "id": 1,
    "firstName": "Phillipa",
    "lastName": "Soo",
    "dateOfBirth": "01/22/1990",
    "mostRecentShow": "Hamilton",
    "numberOfShows": "1",
    "created_at": "2017-04-04 21:30:02",
    "updated_at": "2017-04-04 21:30:02"
}

Here is a sample add actor request:

POST http://localhost:8888/actors
    parameter name: firstName
        value: Phillipa
    parameter name: lastName
        value: Soo
    parameter name: dateOfBirth
        value: 05/31/1990
    parameter name: mostRecentShow
        value: Hamilton
    parameter name: numberOfShows
        value: 1

The above POST request would create a new actor in the database with the specified parameters.

Parameter Descriptions
  • firstName - the actor's first name
  • lastName - the actor's last name
  • dateOfBirth - the day on which the actor was born
  • mostRecentShow - the most recent show the in which the actor actor has been
  • numberOfShows - the number of Broadway musicals in which the actor has been

Sample Response

{
    "actor created": true
}

Sample update actor request

Here is a sample update actor request:

PUT http://localhost:8888/actors/1
    parameter name: mostRecentShow
        value: Amelie
    parameter name: numberOfShows
        value: 2

The above PUT request would update the 'mostRecentShow' and 'numberOfShows' fields of the actor with ID 1.

Sample Response

{
    "actor updated": true
}

Sample delete actor request

Here is a sample delete actor request:

DELETE http://localhost:8888/actors/1

The above DELETE request would delete the actor with ID 1.

Sample Response

{
    "actor deleted": true
}

results matching ""

    No results matching ""