music nerd

AdminChange user roles

Admin

Change user roles

Turns one role on or off for the given users and returns how many were updated. whitelisted marks a trusted contributor, admin grants the admin (turning it on also whitelists the user), and hidden keeps the user off leaderboards.

PATCH/api/admin/users
PATCH/api/admin/users

Turns one role on or off for the given users and returns how many were updated. whitelisted marks a trusted contributor, admin grants the admin (turning it on also whitelists the user), and hidden keeps the user off leaderboards.

Authorization

Authorizationstringrequired

A Music Nerd admin's access token. Copy it at https://musicnerd.net/access after signing in. A signed-in user who is not an admin gets 403. Kept in this tab only.

Body
cURL
curl --request PATCH \
  --url 'https://musicnerd-api.vercel.app/api/admin/users' \
  --header 'Content-Type: application/json' \
  --data '{
  "userIds": [
    "0b1e4c2a-7f3d-4a58-9c61-2d8e5f7a9b10"
  ],
  "role": "whitelisted",
  "enabled": true
}'

Send the request to see the live response here.

Authorizations

Authorizationstringheaderrequired

Bearer authentication header of the form Bearer <token>. A Music Nerd admin's access token. Copy it at https://musicnerd.net/access after signing in. A signed-in user who is not an admin gets 403.

Body

application/jsonrequired
userIdsarray<string>required

The users to change, from Search users or the admin's user list.

minItems: 1

Item properties for userIds

string

rolestring · enumrequired

Values: "whitelisted", "admin", "hidden"

enabledbooleanrequired

true to grant the role, false to remove it.

Response

application/json

The roles are changed. IDs with no user are ignored.

statusstring · enumrequired

Values: "ok"

updatedintegerrequired

How many users were updated.

minimum: 0