跳到主要内容

Player API

概要​

用于获取用户玩家信息的 API 。 

****认可方法​

为了使用该 API ,需要在 Authorization 请求头中指定表中所示按 grant_type, scope 获取的 access token 。 

  • 认可类型 
    • Bearer
  • 支持的  grant_type
    • client_credentials_grant
  • 需要的 scope
    • player:authorizedUsers

终点 URL​

各环境中的终点 URL 如下所述。 

itemdescription
HTTP MethodGET
Request URIsandbox java https://sb-api.andapp.jp/1.0.0/users{/playerId} 正式环境 java https://api.andapp.jp/1.0.0/users{/playerId}

请求示例​

请求示例如下。 

GET /1.0.0/users/4503599627370495 HTTP/1.1
Host: sb-api.andapp.jp:443
Authorization: Bearer {access_token}

响应状态​

成功时的响应状态如下。 

statusdescription
200 OK可正常反馈资源时,反馈此项。

响应头​

响应头如下。 

namevaluerequireddescription
Content-Typeapplication/jsontrue 

响应正文​

响应正文为带有下述参数的 JSON 字符串。详见下述示例。 

propertytitletyperequireddescription

id

玩家 IDintegertrue

该玩家的 Player ID 。

links

IdP 关联对象objecttrue

表示与该玩家关联的外部 Identity Provider 类别的对象。

links.mobageMobage 关联对象objectfalse

该玩家有 Mobage 关联时的存在对象。

links.mobage.createdAt关联开始时间integertrue

该玩家开始 Mobage 关联的时间的UNIX 时间戳值。

links.mobage.updatedAt关联更新时间integertrue 
createdAt创建时间integertrue

该资源的创建时间的UNIX 时间戳值

updatedAt更新时间integertrue

该资源的更新时间的UNIX 时间戳值

 

响应示例(有****IdP 关联的示例) 

 

HTTP/1.1 200 OK
Content-Type: application/json


{
"id": 4503599627370495,
"links": {
"mobage": {
"createdAt": 1439726867,
"updatedAt": 1439726867
}
},
"createdAt": 1439726867,
"updatedAt": 1439726867
}

响应示例(无IdP 关联的示例)​

HTTP/1.1 200 OK
Content-Type: application/json


{
"id": 4503599627370495,
"links": {
},
"createdAt": 1439726867,
"updatedAt": 1439726867
}

响应示例(有****IdP 关联,且****InAppUserId 已绑定时)​

HTTP/1.1 200 OK
Content-Type: application/json

{
"createdAt": 1485255409,
"id": 4503599627370495,
"links": {
"app": {
"createdAt": 1485497186,
"id": "12345",
"updatedAt": 1485502361
},
"mobage": {
"createdAt": 1439726867,
"updatedAt": 1439726867
}
},
"updatedAt": 1485502361
}

响应示例(无****IdP 关联,且****InAppUserId 已绑定时)​

HTTP/1.1 200 OK
Content-Type: application/json

{
"createdAt": 1485255409,
"id": 4503599627370495,
"links": {
"app": {
"createdAt": 1485497186,
"id": "12345",
"updatedAt": 1485502361
}
},
"updatedAt": 1485502361
}

响应示****例(有IdP 关联,且****InAppUserId 和 extras 已绑定时**)**​

HTTP/1.1 200 OK
Content-Type: application/json

{
"createdAt": 1487217000,
"id": 5153322583457792,
"links": {
"app": {
"createdAt": 1487246188,
"extras": {
"baz": "qux",
"foo": "bar"
},
"id": "123456",
"updatedAt": 1487246188
},
"mobage": {
"createdAt": 1487232050,
"updatedAt": 1487232050
}
},
"updatedAt": 1487246188
}

错误响应​

错误响应以 application/problem+json 的形式发出。状态代码和 Problem Type 的 type 属性值如下。 

statustitletypedescription
400Bad Requestabout:blank在URI Template 参数中指定了非法的 Player ID 时,反馈此项
404Not Foundabout:blank在URI Template 参数中指定了不存在的 Player ID 时,反馈此项
500Server Errorabout:blankAPI 服务器端发生错误时,反馈此项
503Service Unavailableabout:blankAPI 服务器暂时不能响应时,反馈此项

错误响应示例​

错误响应的示例如下。 

HTTP/1.1 404 Not Found
Content-Type: application/problem+json

{
"type": "about:blank",
"title": "Not Found",
"code": 404,
"instance": "https://sb-api.andapp.jp/1.0.0/users/4503599627370495"
} 

更新履历​

  • 2016/02/15
    • 由于有 Player Link API 添加,故添加响应示例
  • 2016/08/01
    • 从响应中删除了 deviceAccounts 对象。
  • 2016/07/28
    • 新建