/v2/users/inquiryUserInfo
POST /v2/users/inquiryUserInfo
The inquiryUserInfo
API is used for the merchant to get the user related information after obtaining user authorization.
Sample
Query user information via an access token. The access token is generated via OAuth after authorization is successful.
- Merchant calls this interface with access token (Step 1)
- Wallet server returns user information the to merchant based on the access token (Step 2).
Request sample
{
"accessToken": "281010033AB2F588D14B43238637264FCA5AAF35xxxx",
"authClientId": "202016726873874774774xxxx"
}
Response sample
{
"result": {
"resultCode":"SUCCESS",
"resultStatus":"S",
"resultMessage":"success"
},
"userInfo": {
"userId": "1000001119398804xxxx",
"status": "ACTIVE",
"nickName": "Jack",
"userName": {
"fullName": "Jack Sparrow",
"firstName": "Jack",
"lastName": "Sparrow"
},
"avatar": "http://example.com/avatar.htm?avatarId=FBF16F91-28FB-47EC-B9BE-27B285C23CD3xxxx",
"gender": "MALE",
"birthDate": "2020-07-25",
"nationality": "US",
"loginIdInfos": [
{
"loginId": "1116874199xxx",
"loginIdType": "MOBILE_PHONE"
}
],
"contactInfos": [
{
"contactNo": "1116874199xxx",
"contactType": "MOBILE_PHONE"
}
],
"extendInfo": "{}"
}
}
Structure
Request
Property | Data type | Required | Description | Example |
accessToken | String (128) | Yes | An access token that can be used to access the user resource scope. | "281010033AB2F588D14B43238637264FCA5AAF35xxxx" |
authClientId | String (128) | No | The unqiue auth client ID. | "202016726873874774774xxxx" |
extendInfo | String (4096) | No | the extend information. Wallets and merchants can put extending information in this property. | "This is additional information" |
Response
Property | Data type | Required | Description | Example |
result | Result | Yes | The request result, which contains information related to the request result, such as status and error codes. | { "resultCode":"SUCCESS", "resultStatus":"S", "resultMessage":"success" } |
userInfo | No | User open information. | { "userId": "1000001119398804xxxx", "status": "ACTIVE", "nickName": "Jack", "userName": { "fullName": "Jack Sparrow", "firstName": "Jack", "lastName": "Sparrow" }, "avatar": "http://example.com/avatar.htm?avatarId=FBF16F91-28FB-47EC-B9BE-27B285C23CD3xxxx", "gender": "MALE", "birthDate": "2020-07-25", "nationality": "US", "loginIdInfos": [ { "loginId": "1116874199xxx", "loginIdType": "MOBILE_PHONE" } ], "contactInfos": [ { "contactNo": "1116874199xxx", "contactType": "MOBILE_PHONE" } ], "extendInfo": "{}" } |
Result process logic
In the response, the result.resultStatus
field indicates the result of processing a request as follows.
resultStatus | Decription |
S | It means user information inquiry is successful, merchant can use the accessToken to access the corresponding user resource scope. The corresponding |
U | The API status is unknown. AuthClient may guide user to try again. The corresponding For details, see the Common error codes section. |
F | It means that user information inquiry is failed. The corresponding |
Error codes
Error codes are usually classified into the following categories:
- Common error codes: are common for all Mini Program OpenAPIs.
- API-specific error codes: are listed in the following table.
resultStatus | resultCode | resultMessage |
F | INVALID_ACCESS_TOKEN | The access token is invalid. |
F | INVALID_AUTH_CLIENT | The auth client id is invalid. |
F | EXPIRED_ACCESS_TOKEN | The access token is expired. |
F | EXPIRED_AGENT_TOKEN | The agent token of mini program is expired. |
F | INVALID_AGENT_TOKEN | The agent token of mini program is invalid. |