Link Search Menu Expand Document

Update

/api/v2/badge/update

Post

badges

profiles


Purpose

To allow the admin to update an existing badge.

Body Content [input]

{
    secret: string,
    badgeID: string,
    name: string,
    description: string,
    icon_type: string,
    membersID: string[]
}

Returns if valid [output]

{
    message: string,
    error: 0
}

What the API does

  • Checks if the value of the secret field passed is valid [401].
  • Checks that membersID is not empty [400] and loops through each of its values to ensure that there is a correponding record in the profiles collection with these values [404].
  • Ensures that there is a badge in the badges collection corresponding to the value of the badgeID field passed [404].
  • Saves the document in the badges collection corresponding to the value of the badgeID field passed using the updated values for the name, description, icon_type and/or membersID fields passed.