Player API
概要
用于获取用户玩家信息的 API 。
****认可方法
为了使用该 API ,需要在 Authorization 请求头中指定表中所示按 grant_type, scope 获取的 access token 。
- 认可类型
- Bearer
- 支持的 grant_type
- client_credentials_grant
- 需要的 scope
- player:authorizedUsers
终点 URL
各环境中的终点 URL 如下所述。
| item | description |
|---|---|
| HTTP Method | GET |
| Request URI | sandbox 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}
响应状态
成功时的响应状态如下。
| status | description |
|---|---|
| 200 OK | 可正常反馈资源时,反馈此项。 |
响应头
响应头如下。
| name | value | required | description |
|---|---|---|---|
| Content-Type | application/json | true |
响应正文
响应正文为带有下述参数的 JSON 字符串。详见下述示例。
| property | title | type | required | description |
|---|---|---|---|---|
id | 玩家 ID | integer | true | 该玩家的 Player ID 。 |
links | IdP 关联对象 | object | true | 表示与该玩家关联的外部 Identity Provider 类别的对象。 |
| links.mobage | Mobage 关联对象 | object | false | 该玩家有 Mobage 关联时的存在对象。 |
| links.mobage.createdAt | 关联开始时间 | integer | true | 该玩家开始 Mobage 关联的时间的UNIX 时间戳值。 |
| links.mobage.updatedAt | 关联更新时间 | integer | true | |
| createdAt | 创建时间 | integer | true | 该资源的创建时间的UNIX 时间戳值 |
| updatedAt | 更新时间 | integer | true | 该资源的更新时间的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 属性值如下。
| status | title | type | description |
|---|---|---|---|
| 400 | Bad Request | about:blank | 在URI Template 参数中指定了非法的 Player ID 时,反馈此项 |
| 404 | Not Found | about:blank | 在URI Template 参数中指定了不存在的 Player ID 时,反馈此项 |
| 500 | Server Error | about:blank | API 服务器端发生错误时,反馈此项 |
| 503 | Service Unavailable | about:blank | API 服务器暂时不能响应时,反馈此项 |
错误响应示例
错误响应的示例如下。
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
- 新建