4.1 Create User (创建帐户)

Description (说明)

This API call is used to create a player account.
本功能用于建立玩家账户。

URL (网址)

https://{host}/api/create_user

Request Method

POST

Request Parameters (请求参数)

Field
(栏位)
Type
(型态)
Required
(必要)
Description
(说明)
agentIdStringYAgent ID <= 50 characters
代理帐号
userIdStringYA unique user id (only allow lower case a~z and 0~9) BY WEBSITE <= 50 characters
网站上唯一的用户ID(仅允许小写a~z和0~9)
balanceStringNInitial balance in the account.(By default is 0) decimal places <= 4
账户初始额度(预设为 0)
freeCreditStringNInitial freeCredit in the account.(By default is 0) decimal places <= 4
泥码初始额度(预设为 0)

if your company has not enabled the free credit function, then please ignore this attribute.
若贵司未开启泥码功能,则请忽略此属性
{
  "agentId": "hrgag",
  "userId": "hrgpl0001",
  "balance": "100000.0",
  "freeCredit": "100.0"
}

Return Result (返回结果)

Field
(栏位)
Type
(型态)
Description
(说明)
codeStringStatus Code fixed 4 characters
状态码

Please refer to 5.4 Status Code for details.
详情请参考 5.4 状态代码
dataObject
agentIdStringAgent ID <= 50 characters
代理帐号
userIdStringUser ID <= 50 characters
玩家帐号
balanceStringBalance decimal places <= 4
帐户余额
freeCreditStringFree credit decimal places <= 4
泥码余额

if your company has not enabled the free credit function, then please ignore this attribute.
若贵司未开启泥码功能,则请忽略此属性
{
  "code": "0000",
  "data": {
    "agentId": "hrgag",
    "userId": "hrgpl0001",
    "balance": "100000.0",
    "freeCredit": "100.0"
  }
}

Sample Request For Each Language (各语言请求范例)

Java - OkHttp

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"agentId\":\"hrgag\",\"userId\":\"hrgpl0001\",\"balance\":\"100000.0\",\"freeCredit\":\"100.0\"}");
Request request = new Request.Builder()
  .url("https://{host}/api/create_user")
  .method("POST", body)
  .addHeader("Authorization", "Basic TWpNQ0JSM1NFYnBrYXdSNTpNak1DQlIzU0VicGthd1I1")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();