HTTP API Introduction
Player Network provides a set of HTTP APIs to support its services. To access the HTTP APIs, set up your game on Player Network Console first.
Do not perform stress testing in the Player Network SDK production environment. If the game requires stress testing on its own modules, it is recommended to mock the Player Network SDK authentication request. If you require account services for stress testing, reach out to the Player Network representative in advance.
Basic structure
- Protocol: HTTPS
- Character encoding: UTF-8
- Header:
Content-Type: application/json
- API timeout: 8,100 ms
- Server URL: Dependent on the deployment cluster configured in Player Network Console. Retrieve the cluster information from the console to obtain the corresponding server URL necessary for your project.
URL format
The standard URL format of an HTTP API request is:
https://test.intlgame.com/v2/auth/verify_login?os=1&gameid=11&channelid=1&ts=1528097722&sdk_version=0.1&sig=xxx
\_______________________/\___________________/ \______________________________________________________________/
server URL endpoint path query parameters
Authentication
Player Network HTTP APIs uses a hash code to authenticate requests. For more information on the hash value (the sig
parameter), contact the Player Network representative.
Query parameters
Parameter | Type | Description | Remark |
---|---|---|---|
os | string | Operating system indicator 1: Android 2: iOS 3: Web 4: Linux 5: Windows 6: Nintendo 7: Mac 8: PlayStation 9: Xbox | Required |
gameid | string | Game ID assigned by Player Network | Required |
channelid | int | Login channel ID 1: WeChat 2: QQ 3: Guest 4: Facebook 5: GameCenter 6: GooglePlay 9: Twitter 10: Garena 14: LINE 15: Apple 19: VK 20: Xbox 21: Steam 24: Epic 26: Discord 27: PlayStation 5 30: DMM 32: SquareEnix 33: Supercell 35: Kakao 38: VNG 41: Nintendo Switch | Required |
ts | uint | Unix time | Required |
sig | string | Hash value for authenticating requests, reach out to the Player Network representative for more information | Required |
source | int | Access source 0 or empty: Client SDK 1: Game backend | Required |
sdk_version | string | The provided SDK version Blank by default | Must be included when called by the client |
seq | string | Transparently transmitted parameter Included in the returned JSON string for asynchronous calling Only English letters, numbers, and underscores(_) are permitted Blank by default | Optional |
Request sample
curl -sS -X POST -H 'Content-Type: application/json' 'https://test.intlgame.com/v2/auth/verify_login?channelid=11&gameid=11&os=5&source=0&ts=1590481177&sdk_version=2.0&sig=9d3a9c7257d445ae0b1ff31a4d69c16e'
-d '{"openid":"5574152457717116678","token":"1d9d1dea1c094be1ddfeb9ef48f7f0aad72b5a8b"}'
Token size
The size of the token varies depending on the scenario. Although the current size does not exceed 2048 bytes, it's recommended that developers design their apps to support tokens of variable sizes, as the upper limit may change in the future.
Response and errors
The conventional HTTP status codes are used to indicate the success or failure of a request. For unsuccessful requests with status codes other than 200
, the results should be printed for problem identification. For successful requests with a status code of 200
, the response JSON string is parsed into an array.
The standard response format is:
{
"ret": 0,
"msg": "user is logged in"
}
- ret = 0, indicates a successful request. The relevant response fields can be parsed.
- ret != 0, indicates a request logic failure. The
msg
field contains the specific error information, and no other fields are returned.
For the full list of ret
values, see HTTP API Error Code.