Player API
Overview
This API allows you to get the user's player information.
How to Authorize
To use this API, an access token which retrieve by the grant_type and scope described on the following table must be specified on the Authorization request header.
- Authorization Type
- Bearer
- Supported grant_type
- client_credentials_grant
- The necessary scope
- player:authorizedUsers
Endpoint URL
Endpoint URL in each environment will be following.
| item | description |
|---|---|
| HTTP Method | GET |
| Request URI | sandbox java https://sb-api.andapp.jp/1.0.0/users{/playerId} production java https://api.andapp.jp/1.0.0/users{/playerId} |
Request Example
Request example is as follows.
GET /1.0.0/users/4503599627370495 HTTP/1.1
Host: sb-api.andapp.jp:443
Authorization: Bearer {access_token}
Response Status
The response status when succeeded is as follows.
| status | description |
|---|---|
| 200 OK | When the resource can be returned normally. |
Response Header
Response header is as follows.
| name | value | required | description |
|---|---|---|---|
| Content-Type | application/json | true |
Response Body
The JSON string with the following parameters is sent. Please refer to the example below for details.
| property | title | type | required | description |
|---|---|---|---|---|
id | Player ID | integer | true | The player ID of this player. |
links | IdP cooperation object | object | true | An object that represents the type of the external Identity Provider that cooperates this player. |
| links.mobage | Mobage cooperation object | object | false | An object which exists in the case that this player is connected to the Mobage. |
| links.mobage.createdAt | When the day began with carrying | integer | true | The UNIX timestamp value when started to connect this player to the Mobage. |
| links.mobage.updatedAt | Cooperation update date and time | integer | true | |
| createdAt | Creation date and time | integer | true | The UNIX timestamp when this resource is created. |
| updatedAt | Date Modified | integer | true | The UNIX timestamp when this resource is updated. |
Response Example (In case that the IdP has already been cooperated)
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 4503599627370495,
"links": {
"mobage": {
"createdAt": 1439726867,
"updatedAt": 1439726867
}
},
"createdAt": 1439726867,
"updatedAt": 1439726867
}
Response Example (In case that the IdP is not cooperated yet)
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 4503599627370495,
"links": {
},
"createdAt": 1439726867,
"updatedAt": 1439726867
}
Response Example (In case that the IdP has already been cooperated and the InAppUserId has been linked)
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
}
Response Example (In case that the IdP is not cooperated yet and the InAppUserId has been linked)
HTTP/1.1 200 OK
Content-Type: application/json
{
"createdAt": 1485255409,
"id": 4503599627370495,
"links": {
"app": {
"createdAt": 1485497186,
"id": "12345",
"updatedAt": 1485502361
}
},
"updatedAt": 1485502361
}
Response Example (In case that the IdP has already been cooperated and both the InAppUserId and the extras have been linked)
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
}
Error Response
Error response will be returned in the application/problem+json format. The status code and the value of the type property of Problem Type is as follows.
| status | title | type | description |
|---|---|---|---|
| 400 | Bad Request | about:blank | It will be returned when a bad Player ID is specified in the URI Template parameters |
| 404 | Not Found | about:blank | It will be returned if a nonexistent Player ID is specified in the URI Template parameters |
| 500 | Server Error | about:blank | The error occurs on the API server. |
| 503 | Service Unavailable | about:blank | The API server can't answer temporary. |
Error Response Example
The example of an error response is as follows.
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"
}
Change log
- 2016/02/15
- Along with the Player Link API has been added, add the response example
- 2016/08/01
- Has been deleted deviceAccounts object from the response.
- 2016/07/28
- Created