/bands
Base URL: https://hippohonk-api-642586320677.herokuapp.com/
GET
Summary: Get all bands in the database.
Returns a list of bands ordered by average rating (descending).
Optional filters:
genre_id: only return bands in the specified genre
Code samples
- curl
- python
# All bands
curl /bands
# Filter by genre_id
curl "/bands?genre_id=2"
import requests
BASE_URL = "https://hippohonk-api-642586320677.herokuapp.com/"
url = f"{BASE_URL}/bands"
# All bands
response = requests.get(url)
print(response.status_code)
print(response.json())
# Filter by genre_id
params = {"genre_id": 2}
response = requests.get(url, params=params)
print(response.status_code)
print(response.json())
Responses
Response 200
OK
Response fields
Returns an array
| Field (*) | Type | Description | Example |
|---|---|---|---|
band_id | integer | Unique ID for the band. | |
name | string | Name of the band. | "Faux Real" |
description | text | Summary of the band that can't be captured through genre alone. | "French Art Pop duo producing jams with an eye for performance. We are all living in the United Snakes of America, and the brothers Arndt are the snake charmers.\n" |
average_rating | number | Average rating for the band. | 4 |
location | string | Location the band calls home. | "Los Angeles, CA" |
url | string | URL for the band's website or social media site. | "https://isthisfauxreal.com/" |
genre_id | integer | Unique ID for a genre. | 2 |
genre_name | string | Name for a band's primary genre. | "Art Pop" |
image | string | Path to the web-hosted image. This image should be pre-processed to the correct size and hosted in a secure location. | "Currently not implemented" |
(*) Required field
Example response(s)
List of bands
[
{
"band_id": 1386,
"name": "Phantogram",
"description": "Dark ambient indie electro-pop who have been at the forefront of this genre for a decade.",
"average_rating": 4.89,
"location": "Saratoga Springs, NY",
"url": "http://phantogrammusic.virb.com/music",
"genre_id": 45,
"genre_name": "Synth Pop",
"image": "v1425489534/raqs1rix20wrl4smrg4i.png"
},
{
"band_id": 1608,
"name": "Kishi Bashi",
"description": "A classically trained violinist, Kishi Bashi (the pseudonym of Kaoru Ishibashi) makes highly catchy indie pop tracks using repeated loops of instrumentation and vocals. Unique and mesmerizing live.",
"average_rating": 5,
"location": "Athensa GA",
"url": "http://www.kishibashi.com/music",
"genre_id": 44,
"genre_name": "Indie Pop",
"image": "v1425262448/yzo3mysaolekvammwh00.png"
}
]
Response 400
Invalid query parameter
Response fields
| Field (*) | Type | Description | Example |
|---|---|---|---|
message * | string |
(*) Required field
Example response(s)
genre_id is not a number
{
"error": "Invalid query parameter",
"message": "genre_id must be a number"
}
Response 500
Server error
Response fields
| Field (*) | Type | Description | Example |
|---|---|---|---|
message * | string |
(*) Required field
POST
Summary: Create a new band
Creates a new band in the hippohonk database.
Required params: name, genre_id
Note: Genres are managed as a standardized list to support filtering by genre. Refer to the Genres API documentation to get a list of genres.
Code samples
- curl
- python
curl -X POST /bands \
-H "Content-Type: application/json" \
-d '{
"name": "Jungle",
"genre_id": 2,
"average_rating": 5
}'
import requests
url = "/bands"
payload = {
"name": "Jungle",
"genre_id": 2,
"average_rating": 5
}
response = requests.post(url, json=payload)
print(response.status_code)
print(response.json())
Request body fields
| Field (*) | Type | Description | Example |
|---|---|---|---|
name * | string | Name of the band. | |
description | text | Summary of the band that can't be captured through genre alone. | "French Art Pop duo producing jams with an eye for performance. We are all living in the United Snakes of America, and the brothers Arndt are the snake charmers.\n" |
average_rating | number | Average rating for the band. | 4 |
location | string | Location the band calls home. | "Los Angeles, CA" |
genre_id * | integer | Unique ID for a genre. | 2 |
(*) Required field
Example request(s)
Request with minimum required parameters
{
"name": "Jungle",
"genre_id": 2
}
Request with additional parameters
{
"name": "The Last Dinner Party",
"genre_id": 5,
"average_rating": 5
}
Responses
Response 201
Band creation successful.
Response fields
| Field (*) | Type | Description | Example |
|---|---|---|---|
id | integer | Unique ID for the band. | |
name | string | Name of the band. | "Faux Real" |
description | text | Summary of the band that can't be captured through genre alone. | "French Art Pop duo producing jams with an eye for performance. We are all living in the United Snakes of America, and the brothers Arndt are the snake charmers.\n" |
average_rating | number | Average rating for the band. | 4 |
location | string | Location the band calls home. | "Los Angeles, CA" |
genre_id | integer | Unique ID for a genre. | 2 |
url | string | URL for the band's website or social media site. | "https://isthisfauxreal.com/" |
(*) Required field
Response 500
Server error
Response fields
| Field (*) | Type | Description | Example |
|---|---|---|---|
message * | string |
(*) Required field