Skip to content

PatchUser

Walter Lara edited this page Nov 29, 2023 · 11 revisions

Patch User

Allows to update an existing User. Only allowed if the requestor is the same as the target User.

Request

URLs:

/v1/users/me

/v1/users/{userId}

Method: PATCH

Path Parameters:

Parameter Type Description
userId string UUID of the User to update (notice that only requester ID is allowed).

Query Parameters: None

Headers:

Authorization: Bearer {accessToken}

Content-Type: application/json

Content:

Field Type Description Requirement Type
firstName string User first name. Optional
lastName string User last name. Optional
nickname string User nickname. Optional
pictureUrl string Valid URL of picture image file. Optional
bannerUrl string Valid URL of banner image file. Optional
websiteUrl string Valid URL of User personal website. Optional
twitterUrl string Valid URL of User Twitter account. Optional
instagramUrl string Valid URL of User Instagram account. Optional
spotifyProfile string Spotify artist profile URI. E.g. spotify:artist:xyz for artist link https://open.spotify.com/artist/xyz include. Optional
soundCloudProfile string SoundCloud artist profile permalink. E,g. xyz for artist link https://soundcloud.com/xyz. Optional
appleMusicProfile string Apple Music artist profile ID. E,g. xyz for artist link https://music.apple.com/abcd/efg/xyz. Optional
location string User location. Optional
role string User role. Optional
genre string User genre. Optional
biography string User biography. Optional
companyName string Company name. Optional
companyLogoUrl string Valid URL of company logo image. Optional
companyIpRights boolean Indicates if the IP rights belong to the company. Optional
dspPlanSubscribed boolean Indicates if subscribed to the DSP pricing plan. Optional
walletAddress string User wallet address. Optional
email string Valid email address. Optional
newPassword string Plaintext password. Optional
confirmPassword string Plaintext password confirmation. Required ony if newPassword specified.
currentPassword string Plaintext current password. Required ony if newPassword specified.
authCode string 2FA Code. Required only if email specified.

Content example:

{
    "firstName": "John",
    "lastName": "Doe",
    "nickname": "Johnny"
    "pictureUrl": "https://somewebsite/john-doe.png",
    "role": "Producer",
    "genre": "Pop",
    "biography": "John is a leading Pop Music Producer",
    "walletAddress": "addr123456789123456789",
    "email": "[email protected]",
    "newPassword": "abc1@23",
    "confirmPassword": "abc@123",
    "currentPassword": "wxy_743",
    "authCode": "123456"
}

✅ Success Response

Code: 204 NO CONTENT

Headers: None

❌ Error Responses

1. Bad Request

Code: 400 BAD REQUEST

Condition: If a mandatory content field is missing.

Headers:

Content-Type: application/json

Content example:

{
    "code": 400,
    "description": "Bad Request",
    "cause": "Missing authCode"
}

2. Unauthorized

Code: 401 UNAUTHORIZED

Condition: If {accessToken} is invalid or expired.

3. Forbidden

Code: 403 FORBIDDEN

Condition: If 2FA failed because authCode is invalid or if requestor is not the same as target User.

Headers:

Content-Type: application/json

Content example:

{
    "code": 403,
    "description": "Forbidden",
    "cause": "2FA failed"
}

4. Conflict

Code: 409 CONFLICT

Condition: If email is already registered to another user.

Headers:

Content-Type: application/json

Content example:

{
    "code": 409,
    "description": "Conclict",
    "cause": "Already exists: [email protected]"
}

5. Unprocessable Entity

Code: 422 UNPROCESSABLE ENTITY

Condition: If a content field is malformed or invalid.

Headers:

Content-Type: application/json

Content example:

{
    "code": 422,
    "description": "Unprocessable Entity",
    "cause": "Invalid email: john.doe!gmail.com"
}

See Also

Post User (Add New User)

Get User

Get Users

Get User Count

Delete User

Put User Password (Reset Password)

Clone this wiki locally