跳到主要内容

Player Link API

注意

从2017/03/15 起,允许应用软件首次启动以外的数据继承。

概要​

用于保存玩家绑定的应用软件内用户 ID(InAppUserId)的 API 。 

认****可方法​

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

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

终点 URL​

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

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

请求示例​

请求示例如下。 

POST /1.0.0/users/4503599627370495/link HTTP/1.1
Host: sb-api.andapp.jp:443
Authorization: Bearer {access_token}
Content-Type: application/x-www-form-urlencoded
idp=app&id=12345

请求正文​

可设置带有下述参数的请求参数。 

propertytitletyperequireddescription

idp

关联识别名stringtrue

通过app 固定

id

InAppUserIdstringtrue

指定希望与玩家绑定的应用软件内部用户 ID(InAppUserId)

响应状态​

成功时的响应状态如下。 

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

响应头​

响应头如下。 

namevaluerequireddescription
Content-Typeapplication/jsontrue 

响应正文​

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

propertytitletyperequireddescription

id

玩家 IDintegertrue

该玩家的 Player ID 。

links

IdP 关联对象objecttrue

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

links.appInAppUser 关联对象objectfalse该玩家有InAppUser ID  时的存在对象。
links.app.idInAppUserIDstringtrue设置在玩家中的 InAppUserId (应用特有 ID) 。
links.app.createdAtInAppUserId 设置开始时间integertrue应用软件内部用户 ID(InAppUserId)的设置时间。
links.app.updatedAtInAppUserId 设置更新时间integertrue已设置的应用软件内部用户 ID(InAppUserId)的更时间。
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

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

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

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

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

错误响应​

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

statustitletypedescription
400Bad Requestabout:blank在URI Template 参数中指定了非法的 Player ID 时,反馈此项
404Not Foundabout:blank在URI Template 参数中指定了不存在的 Player ID 时,反馈此项
409Conflictabout:blank

试图绑定的应用软件内部用户 ID(InAppUserId)已与其他有梦宝谷关联的 AndApp 用户绑定时,反馈此项 

请提示必须对该错误进行处理并在新游戏或其他 InAppUserID 中继承。

422TARGET HAS ONCE LINKED MBGA

about:blank

试图绑定的应用软件内部用户 ID(InAppUserId)已与其他有IdP 关联的玩家 ID 绑定时,反馈此项。
500Server Errorabout:blankAPI 服务器端发生错误时,反馈此项
503Service Unavailableabout:blankAPI 服务器暂时不能响应时,反馈此项

错误响应示例​

错误响应示例如下。 

指定的 Player ID 不存在时​

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/link"
} 

试图绑定的应用软件内部用户 ID(InAppUserId)已与其他有梦宝谷关联的 AndApp 用户绑定​

HTTP/1.1 409 Conflict
Content-Type: application/problem+json
{
"type": "https://problems.andapp.jp/1.0.0/common/409/conflict",
"title": "Conflict",
"status": 409,
"detail": "cannot process request with the link object because it has been locked by an other player",
"instance": "https://sb-api.andapp.jp//1.0.0/users/5392399203303424/link"
}

试图绑定的应用软件内部用户 ID**(InAppUserId)曾经其他与有** IdP 关联的玩家 ID 绑定​

HTTP/1.1 422 Unprocessable Entity
Content-Type: application/problem+json
{
"type": "https://problems.andapp.jp/1.0.0/users/422/target_has_once_linked_mbga",
"title": "TARGET HAS ONCE LINKED MBGA",
"status": 422,
"detail": "target has once linked mbga",
"instance": "https://sb-api.andapp.jp//1.0.0/users/5392399203303424/link"
}

更新履历​

  • 2017/07/04
    • 应记载422 的多处部位记载有误,故更正。
  • 2017/03/15
    • Player Link API 的反应有更改,故删改
  • 2017/02/15
    • 新建