Pearson
Always Learning

This API allows you to retrieve user avatars, and create, update, or delete avatars for specific users. This API uses the personaId to identify users.

Note: The personaId is a social based alias for a user in LearningStudio. User personaIds can be retrieved using either the Classmates, or the Course Roster API.


Supported Roles and Authentication Protocols

Type Supported Values
Authentication Protocols OAuth 2.0
Valid for Roles (OAuth 2): Student, Professor, Teaching Assistant, Administrator

API Request

API Endpoints

HTTP Verbs and URIs

  GET /social/v1/avatar/{personaId}
  • Retrieves a user's avatar.
  GET /social/v1/avatar/{personalId}/thumbnail
  • Retrieves a small, iconified version of the full-sized avatar. The icon-sized version of the avatar is created at the time of avatar upload, via create or update. The icon, by default is 75x75; pixels, created by scaling (vs. cropping). As a result, if a non-square image is uploaded for the avatar the icon-sized version could look squashed after resizing.
  POST /social/v1/avatar/{personaId}
  • Create an avatar for a user.
  PUT /social/v1/avatar/{personaId}
  • Update a user's avatar.
  DELETE /social/v1/avatar/{personaId}
  • Delete a user's avatar.
Parameter Description Valid Values
{personaId} Social based alias for a user in LearningStudio. String ID issued by LearningStudio

Query String Parameters

No query string parameters are supported.

Request Headers

For Get and Delete Requests

None.

For POST and PUT Requests

You will need headers that describe the content you're sending to LearningStudio.

Format

 
Content-Length: {length}
Content-Type: multipart/form-data; boundary={boundaryText}

Parameter Descriptions

Name Description Valid Values
{length} The total length (number of characters) of the request body (see below). Any integer number
{boundaryText} Any arbitrary string that will note the sections in a multipart request body. In this API, there is only one section, so this text is used at the start and end of the body (see below). Any random string

Request Body

For GET and DELETE Requests

None.

For POST and PUT Requests

Format

--{boundary}
Content-Type: {mimeType}
Content-Disposition: form-data; name="{filename}"; filename="{filenameWithExt}"
 
{fileContents}
--{boundary}--

Parameter Descriptions

Name Description Valid Values
{boundary} Notes the start and end of the multipart submission. Note, the final line of the payload shows two sets of double-dashes. The closing boundary must have the second set of dashes. The same value used in the Content-Type HTTP header (see previous section).
{mimeType} The MIME Type of the file you're uploading, e.g. image/jpeg. Currently only the following MIME Types are supported:
  • image/gif
  • image/jpeg
  • image/png
{filename} The name of the file you're uploading, without an extension. Valid file name
{filenameWithExt} The name of the file you're uploading, with its extension. Valid file name
{fileContents} The contents of the file. This need not be encoded. Valid file name

API Response

Response HTTP Status Codes and Headers

This API returns the standard HTTP Status Codes used by the LearningStudio APIs. There are no special headers returned by the API.

When creating an avatar, the API will return a status code of 201 - Created with no response body. When a user's avatar is updated or deleted, the API will return a status code of 200 - OK with no response body.

Response Body

For POST, PUT, and DELETE Requests

None.

For GET Requests

Format

     JFIF         6Photoshop 3.0 8BIM     g yJ0DaPyd05LqmutyI-KA   
 ICC_PROFILE   
        mntrRGB XYZ       $ acsp                                     -    ) =ޯ U xB  ʃ9
                               desc  D   ybXYZ      bTRC     dmdd         gXYZ
....

Property Descriptions

Name Description
{fileContents} The contents of the file.

Example: Associate an Avatar to a User

Request

Endpoint

POST /social/v1/avatar/gbtestc_user1

HTTP Headers (Partial)

X-Authorization: Access_Token access_Token=123456789|987654321|10579776|2015-07-30T12%3a09%3a38|97c32d4ca81c4d9d914d4359
Content-Length: 185924
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryGauOMnxlLSzV7Nfo

Body

------WebKitFormBoundaryGauOMnxlLSzV7Nfo
Content-Disposition: form-data; name="picture1"; filename="picture1.jpg"
Content-Type: image/jpeg
 
     JFIF         6Photoshop 3.0 8BIM     g yJ0DaPyd05LqmutyI-KA   
 ICC_PROFILE   
        mntrRGB XYZ       $ acsp                                     -    ) =ޯ U xB  ʃ9
                               desc  D   ybXYZ      bTRC     dmdd         gXYZ  
h   gTRC     
....
------WebKitFormBoundaryGauOMnxlLSzV7Nfo--

Response

HTTP Status Code

201 Created

Example: Get an Avatar

Request

Endpoint

GET /social/v1/avatar/gbtestc_user1

Response

Body

     JFIF         6Photoshop 3.0 8BIM     g yJ0DaPyd05LqmutyI-KA   
 ICC_PROFILE   
        mntrRGB XYZ       $ acsp                                     -    ) =ޯ U xB  ʃ9
                               desc  D   ybXYZ      bTRC     dmdd         gXYZ  
h   gTRC
....

1008 reads
Always Learning
Pearson