Player API
概要
ユーザーのプレイヤー情報を取得する為の API です。
認可方法
この API を利用する為には表に示す grant_type, scope で取得した access token を Authorization リクエストヘッダに指定する必要があります。
- 認可タイプ
- 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 | 不正な Player ID が URI Template パラメータに指定された場合に返されます |
| 404 | Not Found | about:blank | 存在しない Player ID が URI Template パラメータに指定された場合に返されます |
| 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
- 新規作成