跳到主要内容

根据 OpenID 查询用户

GetUserByOpenID:根据 OpenID 获取用户信息。

POST /api/v3/userinfo/get_user_by_openid

请求参数

了解关于查询参数的更多信息,请参见 查询参数

属性数据类型备注描述
openidstring必填唯一用户 ID(最多20个数字字符)
rsp_field[]string选填返回字段。选择要返回的字段,例如 sourcesubscribelocationlanguagetagsattributespreferences
默认: emailopenid

请求示例

curl --request POST "https://openapi.smartlink.intlgame.com/api/v3/userinfo/get_user_by_openid?gameid=${GAME_ID}&seq=${YOUR_RANDOM_STRING}&sig=${SIGNATURE}&ts=${TS}" \
--header 'Content-Type: application/json' \
--data-raw '{
"openid": "1012156612344364",
"rsp_field": [
"source",
"subscribe",
"location",
"language",
"tags",
"attributes",
"preferences"
]
}'

响应参数

属性数据类型描述
codeint返回码
msgstring响应消息
datadata响应数据

响应示例

{
"code": 0,
"msg": "Success",
"data": {
"email": "openid545058834@qq.com",
"openid": "1012156612344364",
"source": [
"API-web",
"CSV"
],
"subscribe": 1,
"location": "004",
"language": "en",
"tags": [
"tag1",
"tag2"
],
"attributes": {
"birthday": "1990-05-09 00:00:00+08:00",
"level": "10",
"nickname": "tang",
"prop":["option1","option2"]
},
"preferences": [
"option1",
"option2"
]
},
"seq": "{YOUR_RANDOM_STRING}"
}