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
secretfield passed is valid [401]. - Checks that
membersIDis not empty [400] and loops through each of its values to ensure that there is a correponding record in theprofilescollection with these values [404]. - Ensures that there is a
badgein thebadgescollection corresponding to the value of thebadgeIDfield passed [404]. - Saves the document in the
badgescollection corresponding to the value of thebadgeIDfield passed using the updated values for thename,description,icon_typeand/ormembersIDfields passed.