GET /api/{service}/{ID}/avatar

Returns the default (current) avatar for the specified resource.

This operation is used by the following services:

  • APIs service
  • Apps service
  • Groups service
  • Users service

For additional usage information, see Usage Note: Difference Between getAvatar and getDefaultAvatar.

Authorization Roles/Permissions: Must be logged in and have permission to view the requested resources. If the user is logged in but doesn't have permission to view certain resources, the operation works, but limited (or empty) results are returned.

This topic includes the following sections:

HTTP Method

GET

Back to top

URL

https://{hostname}/api/{service}/{ID}/avatar

Back to top

Sample Request

This section includes sample requests for different services that use this operation:

Sample request: APIs service

The example below shows a request for the avatar for the specified API.

Request URL

https://{hostname}/api/apis/api19427.acmepaymentscorp/avatar

Sample request headers

Accept: image/png

Sample request body

Not applicable.

Back to top

Sample request: Apps service

The example below shows a request for the avatar for the specified app.

Request URL

https://{hostname}/api/apps/app16964.acmepaymentscorp/avatar

Sample request headers

GET /api/users/user10027.acmepaymentscorp/avatar?cache=false&time=1369162683708 HTTP/1.1
Host: {hostname}
Accept: image/png,image/*;q=0.8,*/*;q=0.5

Sample request body

Not applicable.

Back to top

Sample request: Groups service

The example below shows a request for the avatar for the specified group.

Request URL

https://{hostname}/api/groups/group24386.acmepaymentscorp/avatar

Sample request headers

Accept: image/png

Sample request body

Not applicable.

Back to top

Sample request: Users service

The example below shows a request for the avatar for the specified user. The optional size parameter is included.

Request URL

https://{hostname}/api/users/522320b9-cb6b-495d-ae07-e4b3bfdb3f6a.acmepaymentscorp/avatar?size=75

Sample request headers

GET /api/users/957482b9-ck7f-0gk5-ae07-9flgok5djtus.acmepaymentscorp/avatar?size=75 HTTP/1.1
Host: {hostname}
Accept: image/png,image/*;q=0.8,*/*;q=0.5

Sample request body

Not applicable.

Back to top

Request Headers

For general information on request header values, refer to HTTP Request Headers.

Header Description
Accept image/png
X-Csrf-Token_{fedmemberID} The CSRF prevention header; may or may not be required, depending on platform settings. See CSRF Prevention on the Platform. By default, the CSRF header is not required for GET operations and is required for all others, with a few exceptions relating to user login.

Back to top

Request Parameters

Parameter Parm Type Data Type Required Description
ID Path string Required The unique ID of the resource for which the default avatar is being requested.
size Query Integer Optional The size, in pixels, for the width or height of the avatar image (the image should always be square). We recommend a size of 75 pixels.

Back to top

Response

If successful, this operation returns HTTP status code 200, with the default avatar for the specified resource in the response body.

Back to top

Sample Response

This section includes sample responses for different services that use this operation:

Sample response: APIs service

The sample response below shows successful completion of this operation.

Sample response headers

Status Code: 200 OK
Content-Type: image/png
Cache-Control: public, max-age=604800
Date: Thu, 23 May 2013 19:08:19 GMT

Sample response body

The response body is the image.

Back to top

Sample response: Apps service

The sample response below shows successful completion of this operation.

Sample response headers

Status Code: 200 OK
Content-Type: image/png
Cache-Control: public, max-age=604787
Thu, 23 May 2013 19:12:57 GMT

Sample response body

The response body is the image.

Back to top

Sample response: Groups service

The sample response below shows successful completion of this operation.

Sample response headers

Status Code: 200 OK
Content-Type: image/png
Date: Fri, 21 Jun 2013 19:54:57 GMT

Sample response body

The response body is the image.

Back to top

Sample response: Users service

The sample response below shows successful completion of this operation.

Sample response headers

Status Code: 200 OK
Cache-Control: public, max-age=604768
Content-Type: image/png
Date: Thu, 23 May 2013 19:17:41 GMT

Sample response body

The response body is the image.

Back to top

Response Headers

For general information on response header values, refer to HTTP Response Headers.

Header Description
Content-Type image/png
Cache-Control public, max-age=604800. For information about caching, see How the Platform API Uses Caching.

Back to top

Response Body

Name Type Description
Response image The default avatar for the resource. If the specified resource doesn't have a custom avatar, the default avatar for the resource type is returned.

Back to top

Error Codes/Messages

If the call is unsuccessful an error code/message is returned. One or more examples of possible errors for this operation are shown below.

Item Value
204 No content. For example, you might get this error if there was an error in an ID in the URL.
404

The resource could not be found.

For example, you might get this if the Accept header is set to a wrong value or an ID in the URL is incorrect.
500 An error occurred processing the call.

More information about Akana API Platform API error messages.

Back to top

Related Topics