REST interface for BPD-related resources - UserAvatar Resource - POST Method

Updates the avatar that is associated with the current user. Other users, including users with administrative privileges, are not authorized to change the avatar of the current user.

Sample method invocation

POST /rest/bpm/wle/v1/avatar/{userNameOrID}?avatar={string}

Parameters

Required parameters
NameValue TypeDescription
avatar string
The Avatar image that is uploaded. The related userUpdateTimestamp value is updated at the same time and returns these new userUpdateTimestamp and userAvatarKey values, which combine the userUpdateTimestamp and the userid values
ValueDescription
file
The avatar image file. This file, in binary format, must be in the non-form field, that is, in the multipart form data. The JPG, GIF, and PNG formats are supported. The maximum file size is limited to 512 KB. Smaller file sizes result in better performance.

Request content

None

Response content

User Avatar - user avatar details associated with the current user (UserAvatarData complexType).

The default content type is application/json.

MIME type: application/json


Schema
{  "description": "User Avatar", 
   "type": "object",
   "properties":
   {  
      "userID": {"type": "integer",
         "description": "The user ID of the user that is described by this object."
      },
      "userName": {"type": "string",
         "description": "The user name of the user that is described by this object.",
      },
      "userAvatarImage": {"type": "string",
         "description": "A base64 encoded string representing user avatar.",
      },
	  "userUpdateTimestamp": {"type": "string",
         "description": "The lasted update timestamp of the user avatar.",
      },
      "userAvatarKey": {"type": "string",
         "description": "The key is composed of the userUpdateTimestamp and userID values. However, the default avatar does not need the user identifier and uses only the default userUpdateTimestamp value",
      },

      "imageFormat": {"type": "string",
         "description": "Format of the image. JPG, GIF or PNG. "
      },
      "isDefault": {"type": "string",
         "description": "Indicates if the avatar image returned was default or not."
      }
   }
}
Example content
{
status:"200",
data:
	{
	userID:9,
	userName:"tw_admin",
	userAvatarImage:"iVBORw0KGgoAAAANSUhgILmO2Sz-truncated-R9uVQAAAABJRU5ErkJggg==",
	userAvatarKey:"1494925798718-9",
	userUpdateTimestamp:"1494925798718",
	imageFormat:"jpg",
	isDefault:"false"
	}
}

MIME type: application/xml


Schema
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://rest.bpm.ibm.com/v1/data/useravatar"
	elementFormDefault="unqualified" xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:tns="http://rest.bpm.ibm.com/v1/data/useravatar"
	xmlns:data="http://rest.bpm.ibm.com/v1/data/root" 
	xmlns:cmn="http://rest.bpm.ibm.com/v1/data/common">

    <import schemaLocation="BPMRestData.xsd" namespace="http://rest.bpm.ibm.com/v1/data/root" />
    <import schemaLocation="Common.xsd" namespace="http://rest.bpm.ibm.com/v1/data/common" />

    <!-- 
	 This type represents a user Avatar.
    -->
    <complexType name="UserAvatarData">
	<complexContent>
	    <extension base="data:Data">
		<sequence>
		  <element name="userID" type="long" />

		    <!-- The alphanumeric user name associated with the user -->
		    <element name="userName" type="string" />
		
		    <!-- The Avatar or profile picture of the user -->
		    <element name="userAvatarImage" type="string" />

		    <element name="userAvatarKey" type="string" />

		    <element name="userUpdateTimestamp" type="string" />
		    
		    <element name="imageFormat" type="string" />
		    
		    <element name="isDefault" type="string" />
		</sequence>
	    </extension>
	</complexContent>
    </complexType>


</schema>

Example content
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bpm:ResponseData xmlns:bpm="http://rest.bpm.ibm.com/v1/data" xmlns:ex="http://rest.bpm.ibm.com/v1/data/exception" xmlns:soc="http://rest.bpm.ibm.com/v1/data/social" xmlns:sys="http://rest.bpm.ibm.com/v1/data/system" xmlns:ug="http://rest.bpm.ibm.com/v1/data/usergroup">
  <status>200</status>
  <data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns8="http://rest.bpm.ibm.com/v1/data/useravatar" xsi:type="ns8:UserAvatarData">
    <userID>9</userID>
    <userName>tw_admin</userName>
    <userAvatarImage>wcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL</userAvatarImage>
    <userAvatarKey>1494925798718-9</userAvatarKey>
    <userUpdateTimestamp>1494925798718</userUpdateTimestamp>
    <imageFormat>jpg</imageFormat>
    <isDefault>false</isDefault>
    </data>
</bpm:ResponseData>

MIME type: application/x-javascript

Error Response content

Detailed error information.

The default content type is application/json.

MIME type: application/json


Schema
{  "description": "WLE Error Response", 
   "type": "object",
   "properties":
   {  "status": {"type": "string",
         "description": "The status of the previous API call."
      },
      "exceptionType": {"type": "string",
         "description": "The classname associated with the exception."
      },
      "errorNumber": {"type": "string",
         "description": "Message ID of the exception."
      },
      "errorMessage": {"type": "string",
         "description": "Message text of the exception."
      },
      "errorMessageParameters": {"type": ["string"], "optional": true,
         "description":"Message text parameters of the exception."
      },
      "programmersDetails": {"type": "object", "optional": true,
         "description":"Additional exception details, for example, a stack trace."
      }
   }
} 

MIME type: application/xml


Schema
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://rest.bpm.ibm.com/v1/data/exception"
	elementFormDefault="unqualified" xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:tns="http://rest.bpm.ibm.com/v1/data/exception"
	xmlns:dat="http://rest.bpm.ibm.com/v1/data/root">

    <import schemaLocation="BPMRestData.xsd" namespace="http://rest.bpm.ibm.com/v1/data/root" />
    
    <!--
	This type represents an error response.
    -->    
    <element name="RestRuntimeException">
	<complexType>
	    <sequence>
		<element name="status" type="string"/>
		<element name="Data" type="tns:ExceptionData">
    		</element>
	    </sequence>
	</complexType>
    </element>

    <!-- 
	 This type contains detailed error information associated with an exception.
    -->
    <complexType name="ExceptionData">
	<sequence>
	    <element name="status" type="string"/>

	    <!-- This specifies the java class name of the exception -->
	    <element name="exceptionType" type="string"/>

	    <!-- The message ID of the error message -->
	    <element name="errorNumber" type="string" minOccurs="0"/>

	    <!-- The complete error message -->
	    <element name="errorMessage" type="string"/>

	    <!-- The list of strings inserted into the error message -->
	    <element name="errorMessageParameters" type="string" minOccurs="0" maxOccurs="unbounded"/>

	    <!-- 
		 The stacktrace associated with the exception.
		 Note that this will be omitted unless the "server-stacktrace-enabled" property
		 is enabled in the server's 100Custom.xml file.
	    -->     
	    <element name="programmersDetails" type="string"></element>
	    
	    <!-- Prior responses.  Set if a bulk command was used -->
	    <element name="responses" type="dat:BulkCommandResponses" minOccurs="0"></element>

            <element name="errorData" type="tns:ErrorData" minOccurs="0" />
	</sequence>
    </complexType>

    <complexType name="ErrorData">
        <sequence>
            <element name="code" type="string" />
            <element name="data" type="string" minOccurs="0" />
        </sequence>
    </complexType>
    
</schema>

MIME type: application/x-javascript

Status codes

The method returns one of the following status codes:
CodeDescription
200 OKSuccess completion.
406 Not AcceptableThe requested content type or content encoding is not supported.
500 Internal Server ErrorA severe problem has occurred, programmer's details are provided.

Available since

8.0.0

Parent Topic: UserAvatar Resource