Routes

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

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

Sample Requests and Responses

Get, create, update, or delete a musical with their associated HTTP methods.

Sample list all musicals request

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

GET http://localhost:8888/musicals

Sample Response

[
  {
    "id": 2,
    "title": "Hamilton",
    "theatre": "Richard Rodgers",
    "director": "Thomas Kail",
    "music": "Lin-Manuel Miranda",
    "lyrics": "Lin-Manuel Miranda",
    "book": "Lin-Manuel Miranda",
    "openDate": "01/20/2013",
    "created_at": "2017-04-03 05:05:10",
    "updated_at": "2017-04-03 05:05:50"
  },
  {
    "id": 3,
    "title": "Dear Evan Hansen",
    "theatre": "Music Box Theatre",
    "director": "Michael Greif",
    "music": "Benj Pasek",
    "lyrics": "Justin Paul",
    "book": "Steven Levenson",
    "openDate": "07/10/2015",
    "created_at": "2017-04-04 21:25:45",
    "updated_at": "2017-04-04 21:25:45"
  }
]

Sample view specific musical request

Here is a sample request to view a specific musical with ID 2:

GET http://localhost:8888/musicals/2

Sample Response

{
    "id": 2,
    "title": "Hamilton",
    "theatre": "Richard Rodgers",
    "director": "Thomas Kail",
    "music": "Lin-Manuel Miranda",
    "lyrics": "Lin-Manuel Miranda",
    "book": "Lin-Manuel Miranda",
    "openDate": "01/20/2013",
    "created_at": "2017-04-03 05:05:10",
    "updated_at": "2017-04-03 05:05:50"
}

Sample add musical request

Here is a sample add musical request:

POST http://localhost:8888/musicals
    parameter name: title
        value: Hamilton
    parameter name: theatre
        value: Richard Rodgers
    parameter name: director
        value: Thomas Kail
    parameter name: music
        value: Lin-Manuel Miranda
    parameter name: lyrics
        value: Lin-Manuel Miranda
    parameter name: book
        value: Lin-Manuel Miranda
    parameter name: openDate
        value: 01/20/2015

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

Parameter Descriptions
  • title - the title of the show
  • theatre - the theatre in which the musical is/was performed
  • director - the director of the musical
  • music - the composer of the musical's music
  • lyrics - the writer of the musical's music
  • book - the writer of the musical's book
  • openDate - the date on which the musical opened

Sample Response

{
    "musical created": true
}

Sample update musical request

Here is a sample update musical request:

PUT http://localhost:8888/musicals/1
    parameter name: music
        value: Alex Lacamoire
    parameter name: director
        value: Jeffrey Seller

The above PUT request would update the 'music' and 'director' fields of the musical with ID 1.

Sample Response

{
    "musical updated": true
}

Sample delete musical request

Here is a sample delete musical request:

DELETE http://localhost:8888/musicals/1

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

Sample Response

{
    "musical deleted": true
}

results matching ""

    No results matching ""