Avatar
Overview
Avatar is an API that is used to get an avatar image or the URL of a swf file.
Avatar Object Fields
Value |
Description |
Type |
Namespace |
Remark |
|
---|---|---|---|---|---|
size |
Size |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Either "large"|"medium"|"small" (without the double quotes) |
|
view |
View |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Either "entire"|"upper" (without the double quotes) |
|
emotion |
Emotion |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Either "defined"|"normal"|"smile"|"cry"|"angry"|"shy" (without the double quotes) |
|
dimension |
Choose 2D or 3D |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Either "defined"|"2D"|"3D" (without the double quotes) |
|
transparent |
Transparent |
xs:Boolean |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Either true|false |
|
type |
Format |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Either "image" |
"flash" (without the double quotes) |
extension |
Format extension |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Either "gif"|"png"|"swf" (without the double quotes) |
|
motion |
AvatarItem#id of motion |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Can be used only when the type is flash and the extension is swf |
|
scene |
Scene configuration description of the avatar Flash |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Can be used only when type is flash and extension is swf |
|
fps |
frames per second |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Can be used only when type is flash and extension is swf |
|
appId |
Application ID |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | Required when the type is flash and the extension is swf. Only the current appID or @app can be specified |
|
movieClip |
MovieClip name |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | This parameter is included in the Response when the type is flash and the extension is swf. string |
|
url |
URL of the avatar image |
xs:string |
http://ns.dena.jp/mbga/gameapi/v1#avatar | – |
API Request
HTTP Methods
Proxy model
- GET - Gets an avatar image
Endpoint URL
- Sandbox environment
http://sb.sp.app.mbga.jp/api/restful/v1/avatar/{-list|;|guid}/{selector}{-prefix|/|parameters}
- Production environment
http://sp.app.mbga.jp/api/restful/v1/avatar/{-list|;|guid}/{selector}{-prefix|/|parameters}
URI Template Parameter
guid
Specify one of the following values for the guid parameter.
Value |
Description |
Remark |
---|---|---|
@me |
guid of the viewer |
Required |
{-list|;|guid} |
User ID |
Required |
- You can specify more than one guid separated by semicolons.
selector
Specify the following value for the selector parameter.
Value |
Description |
Remark |
---|---|---|
@self |
Entry resource for the avatar image specified in the guid parameter for this user |
Required |
parameters
parameters is used for describing the format of the avatar image. It is formed by constructing key=value pairs from the following table separated by semicolons.
The following table shows the keys and values that can be specified along with the default values when the corresponding keys are omitted.
key |
value |
default |
Description |
---|---|---|---|
size |
large |
false |
Large image |
size |
medium |
true |
Medium image |
size |
small |
false |
Small image |
view |
entire |
true |
Entire |
view |
upper |
false |
Upper half |
emotion |
defined |
true |
Emotion currently set by the user |
emotion |
normal |
false |
Emotion - normal |
emotion |
normal |
false |
Emotion - smiling |
emotion |
normal |
false |
Emotion - crying |
emotion |
normal |
false |
Emotion - angry |
emotion |
normal |
false |
Emotion - shy |
dimension |
defined |
true |
Dimension currently set by the user |
dimension |
2d |
false |
2D avatar |
dimension |
3d |
false |
3D avatar |
transparent |
true |
false |
Transparent ON |
transparent |
false |
true |
Transparent OFF |
type |
image |
true |
Obtain as image |
type |
flash |
false |
Obtain as flash |
extension |
gif |
true |
Obtain as gif image |
extension |
png |
false |
Obtain as png image |
extension |
swf |
false |
Obtain as swf |
motion |
{itemId} |
undefined |
Apply specified motion when working with swf |
scene |
{scene} |
undefined |
Create swf using specified scene settings when working with swf |
appId |
{appId} |
undefined |
Specify current appId or @app when working with swf (required) |
The following table shows the image sizes that are supported for various combinations of size and view.
size |
view |
width |
height |
---|---|---|---|
large |
entire |
120 |
160 |
large |
upper |
60 |
80 |
medium |
entire |
60 |
80 |
medium |
upper |
30 |
40 |
small |
entire |
30 |
40 |
When size is defined to be 'small', view cannot be specified as 'upper'.
scene descriptor
When working with an swf file, the scene descriptor allows you to select 8 frames in the motion out of a total of 36 that will be used in the scene. The scene descriptor is configured as follows.
(scene descriptor) = {-join|-|scene}
The scene settings are delimited by hyphens "-". An individual scene setting is described as follows.
{scene} = {label}.{-join|.|frameId}.{endExpression}
The meaning of the parameters is shown below.
Name |
Meaning |
---|---|
label |
Name assigned to the scene. A string consisting of alphanumeric characters and underscores. |
frameId |
A number up to 36 identifying the frame. Values from 0 to 35 can be specified |
endExpession |
Scene repetition setting. " loop" or "stop" can be specified. |
In the following example,
s1.10.11.stop-s2.13.15.loop
scene label s1 is defined to be frames 10 and 11 which are not repeated. Then, scene label s2 is defined to be frames 13 and 15 which are repeated.
When view is upper, these may be omitted, but they must be specified when view is entire.
Query Parameters
The following query parameter can be specified.
format
The response format can be specified as follows.
Value |
Description |
Remark |
---|---|---|
json |
"application/json; charset=utf8" |
Optional, default value |
API Response
Response Codes
The following is a list of the API response codes.
Request HTTP method |
Response code |
Response message |
Description |
---|---|---|---|
GET |
200 |
OK |
Successfully acquired the data |
GET |
400 |
Bad Request |
Invalid request data |
GET |
401 |
Unauthorized |
OAuth authorization failed |
GET |
403 |
Forbidden |
Cannot access data for a reason other than an authentication error |
GET |
404 |
Not Found |
The user does not exist, or is not allowed to perform the operation |
GET |
405 |
Method Not Allowed |
Method is not allowed |
GET |
500 |
Internal Server Error |
Failed because of an API problem |
Notes
Notes on Acquiring Image Data
- When dimension is 2D (for obtaining a 2D avatar), true (transparent ON) cannot be specified for the transparent parameter.
- When dimension is 3D (for obtaining a 3D avatar). the data cannot be obtained as an animation GIF/PNG when view is upper.
Notes on Acquiring swf Data
- When size is 'small', you cannot specify 'upper' for view.
- When swf is specified, you can only specify 3d for dimension.
- If you omit {itemID} for motion when view is 'upper', the current motion specified by the user will be used. If entire is specified, you must also specify {itemID} for motion.
- When view is 'upper', you do not need to specify the scene descriptor. If you do not specify a scene descriptor, "s1.0.stop" will be used instead. If entire is specified, you must specify a scene descriptor.
- movieClip names are numbered automatically. Please see the description of the movieClip field in the Response data.
Common Notes
- When the value of a parameter is set to "defined", the defined value is returned in the response data.
- If dimension is explicitly specified as 3D but the user does not have a 3D avatar, 400 Bad Request is returned.
- If more than one guid is specified, the total number cannot exceed 1000. However, from a performance standpoint, you should only specify the minimum number of guids necessary.
- If an avatar is requested for a non-existent user or for a user who has already left, 404 Not Found is returned.
- If anything other than @self is specified for the selector parameter, 400 Bad Request is returned.
- If the user has not installed the corresponding application, 403 will be returned for the response code.
Examples
Getting the Default Avatar
This example shows how to get the default avatar of the viewer.
Request Format
GET /api/restful/v1/avatar/@me/@self
Response Format
200 OK Content-Type: application/json; charset=utf8 { "startIndex" : 1, "itemsPerPage" : 1, "totalResults" : 1, "avatar" : { "extension" : "gif", "dimension" : "2d", "view" : "entire", "scene" : null, "appId" : null, "fps" : 12, "emotion" : "shy", "url" : "http://sb-sp.app.mbga.jp/img_op/10236/10000000/10.0.0.0.11.gif?consumer_key=f15cb13613e1bb51d103&guid=ON&sign=ceb2ed30ca9e09845ae56dc6fdaebe69a4d0eda9a82340e89aa45dd6cb64d41d", "motion" : 0, "transparent" : false, "type" : "image", "size" : "medium" } }
Sample Image
More Complex Example
- size - large
- dimension - defined
- emotion - shy
- view - upper
- transparent - true
Consider the case when the above values are specified.
Request Format
GET /api/restful/v1/avatar/@me/@self/size=large;dimension=defined;emotion=shy;transparent=true;view=upper
Response Format
{ "startIndex" : 1, "itemsPerPage" : 1, "totalResults" : 1, "avatar" : { "extension" : "gif", "dimension" : "2d", "view" : "upper", "scene" : null, "appId" : null, "fps" : 12, "emotion" : "shy", "url" : "http://sb-sp.app.mbga.jp/img_op/10236/10000000/1.5.0.0.11.gif?consumer_key=f15cb13613e1bb51d103&guid=ON&sign=0baf11a32a7384cd4c95bf1a564921203f0a888efc4494941c1e19a033c01ff8", "motion" : 0, "transparent" : false, "type" : "image", "size" : "large" } }
Sample Image
Getting Multiple Avatars
Request Format
GET /api/restful/v1/avatar/10236;18407/@self/size=large;view=upper;dimension=2d;emotion=angry?format=json
Response Format
200 OK Content-Type: application/json { "entry" : { "sp.sb.mobage-platform.kr: 18407" : { "extension" : "gif", "dimension" : "2d", "view" : "upper", "scene" : null, "appId" : null, "fps" : 12, "emotion" : "angry", "url" : "http://sb-sp.app.mbga.jp/img_op/18407/10000000/1.3.1.0.5.gif?consumer_key=f15cb13613e1bb51d103&guid=ON&sign=bb478da73c763f1b3e2b9e7354a95e4526e2fe14ef80e1350faa7086db2c408c", "motion" : 0, "transparent" : false, "type" : "image", "size" : "large" }, "sp.sb.mobage-platform.kr: 10236" : { "extension" : "gif", "dimension" : "2d", "view" : "upper", "scene" : null, "appId" : null, "fps" : 12, "emotion" : "angry", ? "url" : "http://sb-sp.app.mbga.jp/img_op/10236/10000000/1.3.1.0.11.gif?consumer_key=f15cb13613e1bb51d103&guid=ON&sign=6ca5cea4ceea97f7828f0679f488f78ba6606c4bb8c319fedc1ac55d7c3621a9", "motion" : 0, "transparent" : false, "type" : "image", "size" : "large" } }, "startIndex" : 1, "itemsPerPage" : 50, "totalResults" : 2 }
Getting a Motion Avatar
This example shows how to get the motion avatar of the viewer.
Request Format
GET /api/restful/v1/avatar/@me/@self/dimension=3d;extension=swf;scene=s1.0.7.14.21.28.35.loop;motion=3513000001;type=flash;appId=@app
Response Format
200 OK Content-Type: application/json; charset=utf8 { "startIndex" : 1, "itemsPerPage" : 1, "totalResults" : 1, "avatar" : { "extension" : "swf", "emotion" : "normal", "movieClip" : "a1", "scene" : "s1.0.7.14.21.28.35.loop", "size" : "medium", "view" : "entire", "dimension" : "3d", "appId" : "@app", "fps" : 12, "url" : "http://sb-sp.app.mbga.jp/swf_op/18407/1/12000150/3513000001/10.9.0.0.1.swf?sc=s1%2C0%2C7%2C14%2C21%2C28%2C35%2Cloop&fps=12&nm=a1&consumer_key=f15cb13613e1bb51d103&sign=8306f490ae4cd7374e9c81970b95e46a793a22e603557f0c3bf554cb450ee099", "transparent" : false, "motion" : "3513000001", "type" : "flash" } }
Sample Image
Reference Links
XML Schema Part 2: Datatypes Second Edition
URI Template draft-gregorio-uritemplate-03
Revision History
- 12/11/2012
- Initial release