avatarService

Provides the ability to manage user avatar configuration. An avatar is an image that represents a user in the application UI. Settings made through this service correspond to the admin console page at People > Settings > Avatar Settings.
Method Description
createAvatar Creates a new avatar for a user using the specified byte array as the contents of the avatar image.
deleteAvatar Deletes an avatar from the system.
getActiveAvatar Returns the active avatar for the specified user, or the SystemDefaultAvatar if the user does not have an active avatar specified.
getAvatar Returns an avatar by its ID.
getAvatarCount Used to acquire a count of all the avatars for a specific user.
getAvatars Returns a list of avatars for the specified user.
getGlobalAvatars Returns a list of all of the global avatars.
getMaxAllowableHeight Returns the maximum allowable height for an avatar image.
getMaxAllowableWidth Returns the maximum allowable width for an avatar image.
getMaxUserAvatars Returns the maximum number of avatars a user is allowed to have; returns -1 when there is no limit.
getModerationAvatarCount Returns a count of all the avatars that require moderation.
getModerationAvatars Returns a collection of all of the avatars that require moderation.
isAllowImageResize Returns true if the system should attempt to resize avatar images.
isAvatarsEnabled Returns true if the avatars feature is enabled; false otherwise.
isModerateUserAvatars Returns whether or not user avatars will be moderated.
isUserAvatarsEnabled Returns true if users can create their own avatars; false otherwise.
setActiveAvatar Sets the specified avatar as the user's avatar.
setAllowImageResize Set whether the system should attempt to resize avatar images.
setMaxAllowableHeight Sets the maximum allowable height for an avatar image.
setMaxAllowableWidth Sets the maximum allowable width for an avatar image.
setMaxUserAvatars Sets the maximum number of avatars a user can have.
setModerateUserAvatars Sets whether or not user-create avatars will be moderated.
setUserAvatarsEnabled Sets whether or not users can create their own custom avatars.

createAvatar

Creates a new avatar for a user using the specified byte array as the contents of the avatar image.

POST http://domain:port/application_context/rpc/rest/avatarService/avatars

Arguments

Name Type Description
ownerID xs:long ID of the user to create the avatar for.
name xs:string Name of the avatar image.
contentType xs:string MIME type of the avatar image.
data xs:base64Binary Image contents as a byte array.

Arguments Template

<createAvatar> 
    <ownerID>xs:long</ownerID>
    <name>xs:string</name>
    <contentType>xs:string</contentType>
    <!-- List of ... -->
    <data>xs:base64Binary</data>
</createAvatar>

Response

Type Description
Avatar The newly created avatar.

Response Template

<createAvatarResponse> 
    <return>
        <!-- Contents of Avatar -->
    <return>
</createAvatarResponse>

Errors

Error When Returned
UserNotFound If the specified user does not exist.
com.jivesoftware.community.AvatarException If there is a problem creating the avatar.
Unauthorized If the user doesn't have permission to create avatars.

deleteAvatar

Deletes an avatar from the system.

DELETE http://domain:port/application_context/rpc/rest/avatarService/avatar/{avatarID}

Arguments

Name Type Description
avatarID xs:long ID of the avatar to delete.

Arguments Template

<deleteAvatar> 
    <avatarID>xs:long</avatarID>
</deleteAvatar>

Errors

Error When Returned
Unauthorized

getActiveAvatar

Returns the active avatar for the specified user, or the SystemDefaultAvatar if the user does not have an active avatar specified. The active avatar is the one set for the user.

GET http://domain:port/application_context/rpc/rest/avatarService/activeAvatar/{userID}

Arguments

Name Type Description
userID xs:long ID of the user to acquire an avatar for.

Arguments Template

<getActiveAvatar> 
    <userID>xs:long</userID>
</getActiveAvatar>

Response

Type Description
Avatar An avatar for the specified user.

Response Template

<getActiveAvatarResponse> 
    <return>
        <!-- Contents of Avatar -->
    <return>
</getActiveAvatarResponse>

Errors

Error When Returned
UserNotFound If the specified user does not exist.
com.jivesoftware.community.AttachmentNotFoundException It there is a problem loading the avatar's image

getAvatar

Returns an avatar by its ID.

GET http://domain:port/application_context/rpc/rest/avatarService/avatarByID/{avatarID}

Arguments

Name Type Description
avatarID xs:long Unique ID of the avatar to get.

Arguments Template

<getAvatar> 
    <avatarID>xs:long</avatarID>
</getAvatar>

Response

Type Description
Avatar The avatar.

Response Template

<getAvatarResponse> 
    <return>
        <!-- Contents of Avatar -->
    <return>
</getAvatarResponse>

Errors

Error When Returned
com.jivesoftware.community.AttachmentNotFoundException If there is a problem loading the avatar's image.

getAvatarCount

Used to acquire a count of all the avatars for a specific user.

GET http://domain:port/application_context/rpc/rest/avatarService/avatarCount/{userID}

Arguments

Name Type Description
userID xs:long ID of the user to count avatars for.

Arguments Template

<getAvatarCount> 
    <userID>xs:long</userID>
</getAvatarCount>

Response

Type Description
xs:int The number avatars the user has.

Response Template

<getAvatarCountResponse> 
    <return>xs:int</return>
</getAvatarCountResponse>

Errors

Error When Returned
UserNotFound If the specified user does not exist.

getAvatars

Returns a list of avatars for the specified user.

GET http://domain:port/application_context/rpc/rest/avatarService/avatarsByUser/{userID}

Arguments

Name Type Description
userID xs:long ID of the user whose avatars should be returned.

Arguments Template

<getAvatars> 
    <userID>xs:long</userID>
</getAvatars>

Response

Type Description
List of Avatar A list of Avatar objects

Response Template

<getAvatarsResponse> 
    <!-- List of ... -->
    <return>
        <!-- Contents of Avatar -->
    <return>
</getAvatarsResponse>

Errors

Error When Returned
UserNotFound If the specified user does not exist

getGlobalAvatars

Returns a list of all of the global avatars. Global avatars are those configured for use across the application. Users can choose from among these avatars when choosing their own.

GET http://domain:port/application_context/rpc/rest/avatarService/globalAvatars

Response

Type Description
List of Avatar A list of the global avatars.

Response Template

<getGlobalAvatarsResponse> 
    <!-- List of ... -->
    <return>
        <!-- Contents of Avatar -->
    <return>
</getGlobalAvatarsResponse>

getMaxAllowableHeight

Returns the maximum allowable height for an avatar image.

GET http://domain:port/application_context/rpc/rest/avatarService/avatarMaxAllowableHeight

Response

Type Description
xs:int The maximum allowable height for an avatar image.

Response Template

<getMaxAllowableHeightResponse> 
    <return>xs:int</return>
</getMaxAllowableHeightResponse>

getMaxAllowableWidth

Returns the maximum allowable width for an avatar image.

GET http://domain:port/application_context/rpc/rest/avatarService/avatarMaxAllowableWidth

Response

Type Description
xs:int The maximum allowable width for an avatar image.

Response Template

<getMaxAllowableWidthResponse> 
    <return>xs:int</return>
</getMaxAllowableWidthResponse>

getMaxUserAvatars

Returns the maximum number of avatars a user is allowed to have; returns -1 when there is no limit.

GET http://domain:port/application_context/rpc/rest/avatarService/maxUserAvatars

Response

Type Description
xs:int The maximum number of avatars a user is allowed to have; -1 when the number is unlimited.

Response Template

<getMaxUserAvatarsResponse> 
    <return>xs:int</return>
</getMaxUserAvatarsResponse>

getModerationAvatarCount

Returns a count of all the avatars that require moderation.

GET http://domain:port/application_context/rpc/rest/avatarService/moderationAvatarCount

Response

Type Description
xs:int The number of avatars that require moderation.

Response Template

<getModerationAvatarCountResponse> 
    <return>xs:int</return>
</getModerationAvatarCountResponse>

getModerationAvatars

Returns a collection of all of the avatars that require moderation.

GET http://domain:port/application_context/rpc/rest/avatarService/moderationAvatars

Response

Type Description
List of Avatar A list of all of the avatars that require moderation.

Response Template

<getModerationAvatarsResponse> 
    <!-- List of ... -->
    <return>
        <!-- Contents of Avatar -->
    <return>
</getModerationAvatarsResponse>

Errors

Error When Returned
Unauthorized If the caller is not a system administrator.

isAllowImageResize

Returns true if the system should attempt to resize avatar images.

GET http://domain:port/application_context/rpc/rest/avatarService/avatarAllowImageResize

Response

Type Description
xs:boolean true if the system should attempt to resize images.

Response Template

<isAllowImageResizeResponse> 
    <return>xs:boolean</return>
</isAllowImageResizeResponse>

isAvatarsEnabled

Returns true if the avatars feature is enabled; false otherwise.

GET http://domain:port/application_context/rpc/rest/avatarService/avatarsEnabled

Response

Type Description
xs:boolean true if the avatars feature is enabled; false otherwise.

Response Template

<isAvatarsEnabledResponse> 
    <return>xs:boolean</return>
</isAvatarsEnabledResponse>

isModerateUserAvatars

Returns whether or not user avatars will be moderated. The default value is true.

GET http://domain:port/application_context/rpc/rest/avatarService/moderateUserAvatars

Response

Type Description
xs:boolean true if user avatars will be moderated; false otherwise.

Response Template

<isModerateUserAvatarsResponse> 
    <return>xs:boolean</return>
</isModerateUserAvatarsResponse>

isUserAvatarsEnabled

Returns true if users can create their own avatars; false otherwise. If custom user avatars are enabled, the number of custom avatars allowed per user and whether or not custom avatars should be moderated can be set using setMaxUserAvatars(int max) and setModerateUserAvatars(boolean moderateUserAvatars), respectively.

GET http://domain:port/application_context/rpc/rest/avatarService/userAvatarsEnabled

Response

Type Description
xs:boolean true if custom user avatars are enabled; false otherwise.

Response Template

<isUserAvatarsEnabledResponse> 
    <return>xs:boolean</return>
</isUserAvatarsEnabledResponse>

setActiveAvatar

Sets the specified avatar as the user's avatar. The avatar can be either a global avatar or one that belongs to the user. To set no active avatar for the user, pass -1 for the avatar value.

POST http://domain:port/application_context/rpc/rest/avatarService/activeAvatar

Arguments

Name Type Description
userID xs:long ID of the user to set the avatar for.
avatarID xs:long ID of the avatar to make active.

Arguments Template

<setActiveAvatar> 
    <userID>xs:long</userID>
    <avatarID>xs:long</avatarID>
</setActiveAvatar>

Errors

Error When Returned
Unauthorized If the avatar does not belong to the user or it is not global.
UserNotFound If the specified user does not exist.

setAllowImageResize

Set whether the system should attempt to resize avatar images.

POST http://domain:port/application_context/rpc/rest/avatarService/avatarAllowImageResize

Arguments

Name Type Description
isAllowImageResize xs:boolean whether the system should attempt to resize images.

Arguments Template

<setAllowImageResize> 
    <isAllowImageResize>xs:boolean</isAllowImageResize>
</setAllowImageResize>

Errors

Error When Returned
Unauthorized If the caller is not a system administrator.

setMaxAllowableHeight

Sets the maximum allowable height for an avatar image.

POST http://domain:port/application_context/rpc/rest/avatarService/avatarMaxAllowableHeight

Arguments

Name Type Description
height xs:int The maximum allowable height for an avatar image.

Arguments Template

<setMaxAllowableHeight> 
    <height>xs:int</height>
</setMaxAllowableHeight>

Errors

Error When Returned
Unauthorized If the caller is not a system administrator.

setMaxAllowableWidth

Sets the maximum allowable width for an avatar image.

POST http://domain:port/application_context/rpc/rest/avatarService/avatarMaxAllowableWidth

Arguments

Name Type Description
width xs:int The maximum allowable width for an avatar image.

Arguments Template

<setMaxAllowableWidth> 
    <width>xs:int</width>
</setMaxAllowableWidth>

Errors

Error When Returned
Unauthorized If the caller is not a system administrator.

setMaxUserAvatars

Sets the maximum number of avatars a user can have.

POST http://domain:port/application_context/rpc/rest/avatarService/maxUserAvatars

Arguments

Name Type Description
max xs:int The maximum number of avatars a user can have.

Arguments Template

<setMaxUserAvatars> 
    <max>xs:int</max>
</setMaxUserAvatars>

Errors

Error When Returned
Unauthorized If the caller is not a system administrator.

setModerateUserAvatars

Sets whether or not user-create avatars will be moderated. The default value is true.

POST http://domain:port/application_context/rpc/rest/avatarService/moderateUserAvatars

Arguments

Name Type Description
moderateUserAvatars xs:boolean true to moderate user-created avatars; false to not moderate them.

Arguments Template

<setModerateUserAvatars> 
    <moderateUserAvatars>xs:boolean</moderateUserAvatars>
</setModerateUserAvatars>

Errors

Error When Returned
Unauthorized If the caller is not a system administrator.

setUserAvatarsEnabled

Sets whether or not users can create their own custom avatars. If custom user avatars are enabled, the number of custom avatars allowed per user and whether or not custom avatars should be moderated can be set using setMaxUserAvatars(int max) and setModerateUserAvatars(boolean moderateUserAvatars), respecitvely.

POST http://domain:port/application_context/rpc/rest/avatarService/userAvatarsEnabled

Arguments

Name Type Description
enableCustomAvatars xs:boolean true if custom user avatars are enabled, false otherwise.

Arguments Template

<setUserAvatarsEnabled> 
    <enableCustomAvatars>xs:boolean</enableCustomAvatars>
</setUserAvatarsEnabled>