Difference between revisions of "Avatar URL"

From King Arthur's Gold Wiki
Jump to: navigation, search
(Make info about avatars a tad clear and fix a couple of typos)
(Add explanation with regard to avatar's extension)
Line 5: Line 5:
 
'''HTTP Auth Required:''' No<br/>
 
'''HTTP Auth Required:''' No<br/>
  
 +
An avatar is a JPG image.
  
The API can be used to fetch a member's forum avatar URL.
+
The API can be used to fetch a member's forum avatar URL.
  
The URL will not always point to the forums
+
The URL will not always point to the forums.
 
The resource will return 404 if the user doesn't exist or does not have a forum avatar set
 
The resource will return 404 if the user doesn't exist or does not have a forum avatar set
  

Revision as of 14:50, 26 April 2012

Implementation Status: Implemented
URI: https://api.kag2d.com/player/$PLAYER/avatar
HTTP Verbs Supported: GET
Response Type: JSON dictionary
HTTP Auth Required: No

An avatar is a JPG image.

The API can be used to fetch a member's forum avatar URL.

The URL will not always point to the forums. The resource will return 404 if the user doesn't exist or does not have a forum avatar set

If the avatar is being used in a site, it is strongly recommended that you cache the user's avatar URL for some amount of time, do not call the API on every pageload.

You may call the avatar URL directly (e.g. reference it in the page you give to your users), and are in fact encouraged to do so instead of caching the image itself.

As shown below, the avatars can be requested in 3 sizes currently. Small fits inside a 48px height, medium fits inside a 96px height, and large is 192px. Note that these URLs may not always point to forum.kag2d.com as further profile sharing/centralized profiles are created.

Examples

A URI such as https://api.kag2d.com/player/FliesLikeABrick/avatar will return

{"small": "https://forum.kag2d.com/data/avatars/s/2/2054.jpg",
 "large": "https://forum.kag2d.com/data/avatars/l/2/2054.jpg",
 "medium": "https://forum.kag2d.com/data/avatars/m/2/2054.jpg"}

As you can see, this returns all 3 sizes of avatar. If you know you want a specific size, you can request it directly by appending /s /m or /l to the end of the URI.

Small avatar (48x48px):

https://api.kag2d.com/player/FliesLikeABrick/avatar/s :

{"small": "https://forum.kag2d.com/data/avatars/s/2/2054.jpg"}

Medium avatar (96x96px):

https://api.kag2d.com/player/FliesLikeABrick/avatar/m :

{"medium": "https://forum.kag2d.com/data/avatars/m/2/2054.jpg"}

Large avatar (192x192px):

https://api.kag2d.com/player/FliesLikeABrick/avatar/l :

{"large": "https://forum.kag2d.com/data/avatars/l/2/2054.jpg"}