Skip to content

User Routes

Hong edited this page May 24, 2020 · 3 revisions

User Routes

Endpoint: user/{id}

Method: GET

Description: This API gets a single user.

Path Parameters

Parameters Format
id spotify userid

Response

example request URL: https://localhost:3001/user/12583452

STATUS CODE: 400 NOT FOUND User not found

STATUS CODE: 200 OK - Returns the user

example response

{
    spotifyUserId: 390FGD84JD,
    displayName: Dinith,
    profilePic: image.png,
    friends: [Hong, Nisarag],
    isPrivate: false,
    refreshToken: 234324b62346b4256b4586,
    accessToken: 24213v2329234923435b456,
}

Endpoint: user/{id}

Method: PUT

Description: This API gets a single user.

Body Parameters

Parameters Format
user user object

example body

{
    spotifyUserId: 390FGD84JD,
    displayName: Dinith,
    profilePic: image.png,
    friends: [Hong, Nisarag],
    isPrivate: false,
    refreshToken: 234324b62346b4256b4586,
    accessToken: 24213v2329234923435b456,
}

Response

example request URL: https://localhost:3001/user

STATUS CODE: 400 NOT FOUND User not found

STATUS CODE: 200 OK - Returns the updated object

example response

{
    spotifyUserId: 390FGD84JD,
    displayName: Dinith,
    profilePic: image.png,
    friends: [Hong, Nisarag],
    isPrivate: false,
    refreshToken: 234324b62346b4256b4586,
    accessToken: 24213v2329234923435b456,
}