People
Overview
The People API is used to get a user's profile and a list of the user's friends.
People Object Fields
The following is a list of People object fields supported by the Mobage Open Platform. jobType and bloodtype are proprietary extensions.
Value | Description | Type | Namespace | Remark |
---|---|---|---|---|
id | User ID | xs:string | http://ns.opensocial.org/2008/opensocial | – |
nickname | Nickname | xs:string | http://ns.opensocial.org/2008/opensocial | – |
displayName | Synonymous with nickname | xs:string | http://ns.opensocial.org/2008/opensocial | – |
aboutMe | Self introduction | xs:string | http://ns.opensocial.org/2008/opensocial | – |
birthday | Birthday | xs:date | http://ns.opensocial.org/2008/opensocial | – |
interests | Interests | xs:string | http://ns.opensocial.org/2008/opensocial | Arbitrary input text entered by the user |
profileUrl | URL of the profile | xs:string | http://ns.opensocial.org/2008/opensocial | – |
thumbnailUrl | URL of the thumbnail image | xs:string | http://ns.opensocial.org/2008/opensocial | – |
gender | Gender | xs:string | http://ns.opensocial.org/2008/opensocial | "male" or "femail" or "undisclosed" |
addresses | Region | tns:Address | http://ns.opensocial.org/2008/opensocial | State/province listed in the profile |
jobType | Occupation | xs:string | http://ns.dena.jp/mbga/gameapi/v1 | Arbitrary text entered by the user |
bloodType | Blood type | xs:string | http://ns.dena.jp/mbga/gameapi/v1 | Either "A"|"B"|"O"|"AB" (without the double quotes) |
hasApp | Boolean value indicating whether the application is installed | xs:boolean | http://ns.opensocial.org/2008/opensocial | – |
isVerified | Boolean value indicating if personal authentication has been completed | xs:boolean | http://ns.dena.jp/mbga/gameapi/v1 | – |
isFamous | Boolean value indicating if the user is a virtual user or a celebrity | xs:boolean | http://ns.dena.jp/mbga/gameapi/v1 | – |
grade | User grade | xs:int | http://ns.dena.jp/mbga/gameapi/v1 | Either "1":Guest Account|"2":Standard Account|"3"Verified Account |
API Request
HTTP Methods
Proxy model
- Get - Gets the user's profile, the user's friends list, or a friend's profile
Trusted model
- Get - Gets the user's profile, the user's friends list, or a friend's profile
Endpoint URL
Sandbox environment
http://sb.sp.app.mbga.jp/api/restful/v1/people/{guid}/{selector}{-prefix|/|pid}
Production environment
http://sp.app.mbga.jp/api/restful/v1/people/{guid}/{selector}{-prefix|/|pid}
URI Template Parameters
guid
Specify one of the following values for the guid parameter.
Value |
Description |
Remark |
---|---|---|
@me |
guid of the viewer |
Required |
{guid} |
User ID |
Required |
Before a valid Mobage user ID can be specified with the guid parameter, the user must have installed the associated application.
selector
Specify one of the following values for the selector parameter.
Value |
Description |
Remark |
---|---|---|
@self |
Entry resource for the profile of the user specified in the guid parameter |
Required |
@friends |
Collection resource containing the friends of the user specified in the guid parameter |
Required |
@all |
Synonymous with @friends |
Required |
pid
You can specify the pid parameter when selector is @friends or @all.
Value |
Description |
Remark |
---|---|---|
{guid} |
Actual user ID that is valid in Mobage |
Optional |
Query Parameters
The following query parameters can be specified.
format
The response format is as shown below.
Value |
Description |
Remark |
---|---|---|
json |
"application/json; charset=utf8" |
Optional, default value |
fields
Here, you can specify profile attributes that you wish to obtain. For the fields that can be specified, please see the description of the People object fields.
To specify multiple fields, separate them with commas without any spaces in between.
If you omit the fields parameter, all of the attributes listed below are obtained.
In the interest of performance, you should only get the attributes that you need.
count
When getting a response as a collection resource, you can use the count field to specify the maximum number of entries to obtain. You can include the count field when selector is @friends or @all.
count can be a maximum of 1000, with a default value of 50.
startIndex
For startindex, specify the starting value of the collection resource. If startindex is omitted, 1 is assumed. For example, if there are a total of 100 entries of friends information and they are being displayed as 8 entries per page, then to get the entries forthe second page, you should set count to 8 and startIndex to 9.
filterBy
You can use filterBy when selector is @friends or @all.
If you use filterBy, you can add a search condition for the collection of person objects that will be returned in the response. For the filterBy value, specify a field that will be used as the search condition key.
The filterBy values that can currently be specified are shown below.
filterBy |
Description |
---|---|
hasApp |
Check to see if the application is installed |
When filterBy is specified, filterOp and filterValue must also be specified.
filterOp
You can use filterOp when selector is @friends or @all.
By using filterOp, you can add a search condition for the collection of person objects that will be returned in the response. The filterOp value indicates how the search condition key and value should be evaluated.
The filterOp values that can currently be specified are shown below.
filterOp |
Description |
---|---|
equals |
The field specified by filterBy must match the value specified by filterValue |
When filterOp is specified, filterBy and filterValue must also be specified.
filterValue
You can use filterValue when selector is @friends or @all.
By using filterValue, you can add a search condition for the collection of person objects that will be returned in the response. filterValue indicates the value to be used when evaluating the search condition key.
The values of filterValue that can currently be specified are shown below.
filterValue |
Description |
---|---|
true |
True |
false |
False |
When filterValue is specified, filterBy and filterOp must also be specified.
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 |
The data was acquired successfully |
GET |
400 |
Bad Request |
Invalid request data |
GET |
401 |
Unauthorized |
OAuth authorization failed |
GET |
403 |
Forbidden |
Access failed for some reason other than an authentication error |
GET |
405 |
Method Not Allowed |
Method is not allowed |
GET |
500 |
Internal Server Error |
Failed because of an API problem |
Notes
- Changes to a friends list may not be reflected for up to 10 minutes in the list that is obtained when selector is @friend or @all to prevent the processing load from becoming excessive.
- If a user is recognized as an invalid user by the Review Department, then that user will be considered as not authenticated even if isVerified indicates that the user has been authenticated.
- If a user has not set aboutMe, jobType, or bloodType, the values returned will be null.
- The user specified by guid must exist otherwise 404 will be returned for the response code.
- If fields is set to hasApp and the user has not installed the corresponding application, 200 will be returned for the response code along with a logical value.
- Since a user for which isFamous is true will be a virtual user who is managed by Mobage, that user will not use the application and will be handled differently from an ordinary user.
Examples
Getting the viewer's Profile
This example shows how to get the id, nickname, profileUrl and thumbnailUrl fields of the viewer's profile in application/json format.
Request Format
GET /api/restful/v1/people/@me/@self?fields=id,nickname,profileUrl,thumbnailUrl&format=json
Response Format
200 OK Content-Type: application/json; charset=utf8 { "startIndex" : 1, "person" : { "nickname" : "Taro Mobage", "thumbnailUrl" : "http://sb-sp.mbga.jp/img_u/10000/0.0.gif", "id" : "sp.sb.app.mobage.kr:10000", "hasApp" : true, "profileUrl" : "http://sb-sp.mbga.jp/_u?u=10000" }, "itemsPerPage" : 1, "totalResults" : 1 }
This example shows how to get all fields of the viewer's profile when the user is verified. The user grade is 3.
Request Format
GET /api/restful/v1/people/@me/@self?format=json
Response Format
200 OK Content-Type: application/json; charset=utf8 { "startIndex" : 1, "person" : { "grade" : 3, "hasApp" : true, "isVerified" : true, "bloodType" : "A", "aboutMe" : "自己紹介文", "id" : "sb.mbga.jp:10000", "isFamous" : false, "birthday" : "1990-01-02", "displayName" : "Mobage太郎", "gender" : "male", "interests" : "趣味", "thumbnailUrl" : "http://sb-sp.mbga.jp/img_u/10000/0.0.gif", "nickname" : "Mobage太郎", "jobType" : "職業", "profileUrl" : "http://sb-sp.mbga.jp/_u?u=10000", "addresses" : [ { "formatted" : "東京都" } ] }, "itemsPerPage" : 1, "totalResults" : 1 }
Getting the viewer's friends information
This example shows how to get the id, nickname, profileUrl and thumbnailUrl fields of the viewer's friends in application/json format.
Request Format
GET /api/restful/v1/people/@me/@friends?fields=id,nickname,profileUrl,thumbnailUrl,hasApp&format=json&count=10&startIndex=1
Response Format
200 OK Content-Type: application/json; charset=utf8 { "entry" : [ { "nickname" : "Friend A", "thumbnailUrl" : "http://sb-sp.mbga.jp/img_u/10001/0.0.gif", "id" : "sp.sb.app.mobage.kr:10001", "hasApp": true, "profileUrl" : "http://sb-sp.mbga.jp/_u?u=10001" }, { "nickname" : "Friend B", "thumbnailUrl" : "http://sb-sp.mbga.jp/img_u/10002/0.0.gif", "id" : "sp.sb.app.mobage.kr:10002", "hasApp": false, "profileUrl" : "http://sb-sp.mbga.jp/_u?u=10002" }, { "nickname" : "Friend C", "thumbnailUrl" : "http://sb-sp.mbga.jp/img_u/10003/0.0.gif", "id" : "sp.sb.app.mobage.kr:10003", "hasApp" : true, "profileUrl" : "http://sb-sp.mbga.jp/_u?u=10003" } ], "startIndex" : 1, "itemsPerPage" : 10, "totalResults" : 3 }
Reference Links
OpenSocial RESTful Protocol Specification v0.9 - 7.1 People
XML Schema Part 2: Datatypes Second Edition
URI Template draft-gregorio-uritemplate-03
Revision History
- 12/11/2012
- Initial Release.