test user login :
{
"username": "user",
"password": "password"
}- POST
Expects body:
{
"username": string,
"password": string
}username must be unique
password must be at least 8 characters long
Returns:
{
userID,
username,
jsonWebToken // use this for the Authorization header
}- POST
Expects body:
{
"username": string,
"password": string,
}Returns:
{
userID,
username,
jsonWebToken
}- PUT
expects header :
{
Authorization: jsonWebToken
}expects body:
{
"old_password": string,
"new_password": string
}returns:
{
"message": "Password updated!"
}- DELETE
expects header :
{
Authorization: jsonWebToken
}returns:
{
"message": "User deleted"
} - GET
expects header :
{
Authorization: jsonWebToken
}returns an array of the positive songs for the user:
[
{
"acousticness": 0.953,
"danceability": 0.73,
"duration_ms": 50449,
"energy": 0.33399999999999996,
"instrumentalness": 0.912,
"key": 8,
"liveness": 0.0849,
"loudness": -10.447000000000001,
"mode": 0,
"speechiness": 0.36200000000000004,
"tempo": 81.137,
"time_signature": 4,
"valence": 0.8290000000000001,
"popularity": 24,
"track_name": "Fill Collins",
"track_id": "4Lmr8FBZaUWHfuBqZI0aJ5",
"id": 500
},
...
]- DELETE
expects header :
{
Authorization: jsonWebToken
}expects body :
{
"track_id": number (this number is found on the Track object it self under id)
}returns :
{
"message": "Positive Track deleted!"
}- POST
expects header :
{
Authorization: jsonWebToken
}expects body:
{
"user_id": number,
"track_id": number
}returns : the index of the postive track in the database
- GET
expects header :
{
Authorization: jsonWebToken
}returns an array of the negative songs for the user:
[
{
"acousticness": 0.953,
"danceability": 0.73,
"duration_ms": 50449,
"energy": 0.33399999999999996,
"instrumentalness": 0.912,
"key": 8,
"liveness": 0.0849,
"loudness": -10.447000000000001,
"mode": 0,
"speechiness": 0.36200000000000004,
"tempo": 81.137,
"time_signature": 4,
"valence": 0.8290000000000001,
"popularity": 24,
"track_name": "Fill Collins",
"track_id": "4Lmr8FBZaUWHfuBqZI0aJ5",
"id": 500
},
...
]- POST
expects header :
{
Authorization: jsonWebToken
}expects body:
{
"user_id": number,
"track_id": number
}returns : the index of the negative track in the database
- DELETE
expects header :
{
Authorization: jsonWebToken
}expects body :
{
"track_id": number (this number is found on the Track object it self under id)
}returns :
{
"message": "Negative Track deleted!"
}- GET
expects header :
{
Authorization: jsonWebToken
}can use a query string for page number
example: /api/users/user_predicted_tracks?page_number=5
returns : Tracks based on the users liked/disliked track data
"tracks": [
{
"id": 4,
"track_name": "Lactose",
"track_id": "3J2Jpw61sO7l6Hc7qdYV91",
"acousticness": 0.0294,
"danceability": 0.8,
"duration_ms": 125381,
"energy": 0.579,
"instrumentalness": 0.912,
"key": 5,
"liveness": 0.0994,
"loudness": -12.118,
"mode": 0,
"speechiness": 0.0701,
"tempo": 123.00299999999999,
"time_signature": 4,
"valence": 0.6409999999999999,
"popularity": 9,
"artist_name": "Chris Cooq",
"artist_id": 3
},
{
"id": 19,
"track_name": "Prop - Original mix",
"track_id": "5RCPsfzmEpTXMCTNk7wEfQ",
"acousticness": 0.000256,
"danceability": 0.813,
"duration_ms": 134769,
"energy": 0.598,
"instrumentalness": 0.8909999999999999,
"key": 8,
"liveness": 0.0892,
"loudness": -11.058,
"mode": 1,
"speechiness": 0.0874,
"tempo": 122.01,
"time_signature": 4,
"valence": 0.623,
"popularity": 7,
"artist_name": "Bingo Play",
"artist_id": 5
},
...100 tracks per page
- GET can use a query string, if none default is page 1 with 100 artists per page : /api/arists?page=number&limit=number (limit is number of artists per page)
example 1: /api/artists returns: a list of first 100 artists in the database
example 2: /api/artists?page=5 returns: a list of 100 aritsts on the 5th page
- GET
expects params : /api/artists/artist/name
example: /api/artists/artist/yg
returns:
{
"artist":{
"id": int,
"name": string
},
"tracks":[
{
"id":int,
"track_name": "Big Bank feat. 2 Chainz, Big Sean, Nicki Minaj",
"track_id": "2RM4jf1Xa9zPgMGRDiht8O",
"acousticness": 0.0058200000000000005,
"danceability": 0.743,
"duration_ms": 238373,
"energy": 0.33899999999999997,
"instrumentalness": 0,
"key": 1,
"liveness": 0.0812,
"loudness": -7.678,
"mode": 1,
"speechiness": 0.409,
"tempo": 203.92700000000002,
"time_signature": 4,
"valence": 0.11800000000000001,
"popularity": 44,
"artist_name": "YG",
"artist_id": int
},
]
}- GET
can use a query to change the page of the listed tracks
example: /api/track?page=5
returns a list of all the tracks in the Database:
[
{
"id": 1,
"track_name": "Big Bank feat. 2 Chainz, Big Sean, Nicki Minaj",
"track_id": "2RM4jf1Xa9zPgMGRDiht8O",
"acousticness": 0.0058200000000000005,
"danceability": 0.743,
"duration_ms": 238373,
"energy": 0.33899999999999997,
"instrumentalness": 0,
"key": 1,
"liveness": 0.0812,
"loudness": -7.678,
"mode": 1,
"speechiness": 0.409,
"tempo": 203.92700000000002,
"time_signature": 4,
"valence": 0.11800000000000001,
"popularity": 44,
"artist_name": "YG",
"artist_id": 1
},
...
]- GET
expects params: track_name
example: /api/track/fallin
returns tracks with the characters searched in it's name:
{
"tracks":
{
"id":int,
"track_name": "Big Bank feat. 2 Chainz, Big Sean, Nicki Minaj",
"track_id": "2RM4jf1Xa9zPgMGRDiht8O",
"acousticness": 0.0058200000000000005,
"danceability": 0.743,
"duration_ms": 238373,
"energy": 0.33899999999999997,
"instrumentalness": 0,
"key": 1,
"liveness": 0.0812,
"loudness": -7.678,
"mode": 1,
"speechiness": 0.409,
"tempo": 203.92700000000002,
"time_signature": 4,
"valence": 0.11800000000000001,
"popularity": 44,
"artist_name": "YG",
"artist_id": int
},
...
}- GET
expects params: artist_id
exmaple : /api/track/artist/1000
returns:
{
"tracks":[
{
"id":int,
"track_name": "Big Bank feat. 2 Chainz, Big Sean, Nicki Minaj",
"track_id": "2RM4jf1Xa9zPgMGRDiht8O",
"acousticness": 0.0058200000000000005,
"danceability": 0.743,
"duration_ms": 238373,
"energy": 0.33899999999999997,
"instrumentalness": 0,
"key": 1,
"liveness": 0.0812,
"loudness": -7.678,
"mode": 1,
"speechiness": 0.409,
"tempo": 203.92700000000002,
"time_signature": 4,
"valence": 0.11800000000000001,
"popularity": 44,
"artist_name": "YG",
"artist_id": int
},
]
}- GET
expects params: track_name
exmaple : /api/track/get_closest_tracks/lactose
can access next page of tracks with query string
example : /api/track/get_closest_tracks/lactose/?page_number=5
returns a list of the closest tracks:
{
"tracks":[
{
"id":int,
"track_name": "Big Bank feat. 2 Chainz, Big Sean, Nicki Minaj",
"track_id": "2RM4jf1Xa9zPgMGRDiht8O",
"acousticness": 0.0058200000000000005,
"danceability": 0.743,
"duration_ms": 238373,
"energy": 0.33899999999999997,
"instrumentalness": 0,
"key": 1,
"liveness": 0.0812,
"loudness": -7.678,
"mode": 1,
"speechiness": 0.409,
"tempo": 203.92700000000002,
"time_signature": 4,
"valence": 0.11800000000000001,
"popularity": 44,
"artist_name": "YG",
"artist_id": int
},
...
]
}- POST
can access next page of tracks with query string
example : /api/track/change_feature_values?page_number=5
expects body:
{
"acousticness": 0.0294,
"danceability": 0.8,
"duration_ms": 125381,
"energy": 0.579,
"instrumentalness": 0.912,
"key": 5,
"liveness": 0.0994,
"loudness": -12.118,
"mode": 0,
"speechiness": 0.0701,
"tempo": 123.00299999999999,
"time_signature": 4,
"valence": 0.6409999999999999,
"popularity": 9
}returns a list of tracks based off the target values:
{
"tracks": [
{
"id": 4,
"track_name": "Lactose",
"track_id": "3J2Jpw61sO7l6Hc7qdYV91",
"acousticness": 0.0294,
"danceability": 0.8,
"duration_ms": 125381,
"energy": 0.579,
"instrumentalness": 0.912,
"key": 5,
"liveness": 0.0994,
"loudness": -12.118,
"mode": 0,
"speechiness": 0.0701,
"tempo": 123.00299999999999,
"time_signature": 4,
"valence": 0.6409999999999999,
"popularity": 9,
"artist_name": "Chris Cooq",
"artist_id": 3
},
...
]
}100 tracks per page