Blacklist
本文档无中文版本,
请查看其他语言。
Endpoint for Social API
Note: Social API includes Appdata API, Blacklist API, People API, Profanity API, Leaderboard API, Remote Notification API.
Mobage Simplified Chinese Platform
| Production Social | http://sp.mobage-platform.cn/social/api/restful/v2 |
| Sandbox Social | http://sp.sb.mobage-platform.cn/social/api/restful/v2 |
| Environment | URL |
| --- | --- |
Mobage Traditional Chinese Platform
| Environment | URL |
|---|---|
| Production Social | http://sp.mobage-platform.tw/social/api/restful/v2 |
| Sandbox Social | http://sp.sb.mobage-platform.tw/social/api/restful/v2 |
Data Type Definition
| Name | Type | Description |
|---|---|---|
| id | UserId | A user who has added a targetId user to the blacklist |
| targetId | UserId | A user who has been added to the blacklist by an id user |
Description
This acquires a list of users who are specified in a blacklist.
URI Fragment
/blacklist/{userId}/{groupId}{-prefix|/|personId}
HTTP Method
GET
Supported Formats
JSON
Request Parameters
| Name | Type | Required/Optional | Parameter | Description |
|---|---|---|---|---|
| userId | UserId, Array | Required | URI Template Parameters | @me or direct value |
| groupId | GroupId | Required | URI Template Parameters. | Only @all is specifiable. |
| personId | UserId, Array | Optional | URI Template Parameters | direct value |
| fields | Array | Optional | Query String | the names defined in the data type Blacklist |
| format | String | Optional | Query String | Only json is specifiable |
| count | Number | Optional | Query String | An integer between 1 and 1000. The default value is 50. |
| startIndex | Number | Optional | Query String | An integer of 1 or greater |
| sortBy | String | Optional | Query String | Only targetId is specifiable. |
| sortOrder | String | Optional | Query String | ascending or 'descending' |
Request Body
N/A
Request Headers
Any request to the Mobage REST APIs must include the Authorization header. For more details, see How to add the Authorization Header .
Response Status Code
| HTTP Status Code | HTTP Status Message | Meaning |
|---|---|---|
| 200 | OK | Data successfully acquired |
| 400 | Bad Request | Corrupt request data on the client side |
| 401 | Unauthorized | Authorization error |
| 403 | Forbidden | The resource exists, but access is not possible due to a reason other than an authorization error. |
| 404 | Not Found | The resource doesn’t exist |
| 500 | Internal Server Error | An error on the API server side |
| 503 | Service Unavailable | The API cannot be used temporarily |
Response Body
Example 1. Require a List of Blacklisted Users
HTTP Request
GET /social/api/restful/v2/blacklist/1234/@all
HTTP Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"entry" : [
{
"id" : "sb.mbga.jp:1234",
"targetId" : "sb.mbga.jp:5678",
},
{
"id" : "sb.mbga.jp:1234",
"targetId" : "sb.mbga.jp:6789",
},
],
"startIndex" : 1,
"sorted" : false,
"updatedSince" : false,
"itemsPerPage" : 50,
"totalResults" : 2,
"filtered" : false
}
Example 2. A Blacklist Check between Two Parties
HTTP Request
GET /social/api/restful/v2/blacklist/1234/@all/5678
HTTP Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"id" : "sb.mbga.jp:1234",
"targetId": "sb.mbga.jp:5678",
}
This code returns a 404 error if the user specified in personId is not registered in the blacklist.
HTTP Response
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8
{
"Error" : {
"Code" : "404",
"Message" : "Not Found"
}
}
How to Add the Authorization Header
Step 1. Create the base string**
- build a string for OAuth parameters: firstly sort the following parameters alphabetically and URL encode the names and values, then join name and value with "=", finally join name/value pairs with "
&"
| Parameter | Description | Value |
|---|---|---|
oauth_consumer_key | The Consumer Key for the application | Issued when resist the application |
oauth_nonce | Unique value for each request | Generated on the game server |
oauth_signature_method | Hash method | Only HMAC-SHA1 is specifiable |
oauth_timestamp | UNIX timestamp | Generated on the game server |
oauth_token | The token code | oauth_token is obtained from the token credential. |
oauth_version | OAuth version | Only 1.0 |
- URL encode the following three parameters.
| Parameter | Description |
|---|---|
| Request Method | HTTP Method to the API Server |
| API URL | URL to the API Server (exclude query parameters) |
| OAuth Parameters | A string Built in previous step |
- join the encoded parameters with "&".
Step 2. Generate the oauth_signature
-
Build a secret by joining the Consumer Secret and the Token Secret (obtained from the token credential) with "
&". -
Pass the base string and secret to the HMAC-SHA1 hashing algorithm.
-
the output of HMAC-SHA1 hashing algorithm is a binary string. Use base64 encode to produce the signature string.
A tool is provided to verify whether your signature is correct. Refer to Oauth Signature Tool.
Step 3. Build the Authorization Header
Follow the steps to build the “Authorization” header:
-
URL encode the parameter names and values in the table below
-
Double quote the value, join name and value with "=", join name/value pairs with ","
-
Add realm parameter as an option
-
Add "OAuth " (including the space at the end) to the beginning of the header.
| Parameter | Value |
|---|---|
| oauth_consumer_key | Issued when resist the application |
| oauth_nonce | Generated on the game server |
| oauth_signature | Generated on the game server, Refer to Step 2. Generate the oauth_signature |
| oauth_signature_method | only "HMAC-SHA1" is specifiable |
| oauth_timestamp | Generated on the game server |
| oauth_token | oauth_token is obtained from the token credential. |
| oauth_version | Only 1.0 |
Authorization Header Example
OAuth realm="", oauth_consumer_key="195dcf3f2b64da74549f", oauth_nonce="abb5031d1d767d3626e4", oauth_signature="nzWySwCI9oIUU9mSTnIvrti7V7I%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1363057344", oauth_token="sp_client_id%3A6317c85392724d8914904f708f16d01d", oauth_version="1.0"