Avatars

POST /plugins/Lavatar #

Upload or replace a user's avatar

Adds an avatar for the specified user. If that user already has an avatar, the existing file is deleted before the new image is stored. The authenticated user may update their own avatar. Updating another user's avatar requires the configured MantisBT manage-user access level. Protected users cannot have an avatar added or replaced.

Request body required

user_id integer · int32 required Numeric MantisBT user ID to associate with the avatar.
avatar_image string required Base64 data URI containing the image bytes, for example `data:image/png;base64,<encoded-bytes>`. The decoded image must be JPEG (`image/jpeg`) or PNG (`image/png`) and no larger than 1 MiB (1,048,576 bytes). This endpoint accepts a JSON request body; it does not accept multipart/form-data.

Responses

  • 201 Avatar upload completed. The command returns JSON null.
    "string"
  • 400 The user ID or image data is missing or invalid, the image format is unsupported, or the image exceeds 1 MiB.
    message string required Technical error message from the failed operation.
    code integer required MantisBT error code associated with the failure.
    localized string required Localized MantisBT description for the error code.
    {
        "message": "User id is missing or invalid.",
        "code": 11,
        "localized": "A necessary field was empty. Please recheck your inputs."
    }
  • 401 Authentication is required or the supplied API token is invalid.
  • 403 The caller cannot modify the target user, or the target account is protected.
    message string required Technical error message from the failed operation.
    code integer required MantisBT error code associated with the failure.
    localized string required Localized MantisBT description for the error code.
    {
        "message": "User id is missing or invalid.",
        "code": 11,
        "localized": "A necessary field was empty. Please recheck your inputs."
    }
  • 404 The target user does not exist.
    message string required Technical error message from the failed operation.
    code integer required MantisBT error code associated with the failure.
    localized string required Localized MantisBT description for the error code.
    {
        "message": "User id is missing or invalid.",
        "code": 11,
        "localized": "A necessary field was empty. Please recheck your inputs."
    }
  • 500 Avatar storage failed unexpectedly.
    message string required Exception message describing the failed operation.
    {
        "message": "User does not have an avatar attached."
    }
cURL
curl -X POST \
  -H "Authorization: Bearer $MANTIS_TOKEN" \
  -H "Content-Type: application/json" \
  https://yourmantishubname.mantishub.io/api/rest/plugins/Lavatar \
  -d '{
    "user_id": 42,
    "avatar_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
}'
Request body · application/json
{
    "user_id": 42,
    "avatar_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
}
DELETE /plugins/Lavatar/{user_id} #

Delete a user's avatar

Removes the stored avatar for the specified user. The authenticated user may delete their own avatar. Deleting another user's avatar requires the configured MantisBT manage-user access level. Protected users cannot have an avatar deleted, and a user without an avatar produces an internal error from the command implementation.

Parameters

Name In Type Description
user_id required path integer · int32 Numeric MantisBT user ID whose avatar is being changed. e.g. 42

Responses

  • 204 Avatar deleted successfully. No response body is returned.
  • 400 The user ID is missing or invalid.
    message string required Technical error message from the failed operation.
    code integer required MantisBT error code associated with the failure.
    localized string required Localized MantisBT description for the error code.
    {
        "message": "User id is missing or invalid.",
        "code": 11,
        "localized": "A necessary field was empty. Please recheck your inputs."
    }
  • 401 Authentication is required or the supplied API token is invalid.
  • 403 The caller cannot modify the target user, or the target account is protected.
    message string required Technical error message from the failed operation.
    code integer required MantisBT error code associated with the failure.
    localized string required Localized MantisBT description for the error code.
    {
        "message": "User id is missing or invalid.",
        "code": 11,
        "localized": "A necessary field was empty. Please recheck your inputs."
    }
  • 404 The target user does not exist.
    message string required Technical error message from the failed operation.
    code integer required MantisBT error code associated with the failure.
    localized string required Localized MantisBT description for the error code.
    {
        "message": "User id is missing or invalid.",
        "code": 11,
        "localized": "A necessary field was empty. Please recheck your inputs."
    }
  • 500 The target user does not have an attached avatar, or avatar deletion failed.
    message string required Exception message describing the failed operation.
    {
        "message": "User does not have an avatar attached."
    }
cURL
curl -X DELETE \
  -H "Authorization: Bearer $MANTIS_TOKEN" \
  https://yourmantishubname.mantishub.io/api/rest/plugins/Lavatar/42