/v1/users/inquiryUserInfo
POST /v1/users/inquiryUserInfo
With this API call, a merchant can inquire about user information with the access token. The specific information to query is defined by the scopes of the authorization code you obtained by calling the my.getAuthCode JSAPI.
Structure
A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:
Request parameters
Field | Data type | Required | Description | Example |
accessToken | String | Yes | The access token is used to access user information. For the specific information that can be accessed, see the my.getAuthCode JSAPI.
Note: Obtain this field via the /v1/authorizations/applyToken API. | "281010033AB2F588D14B43238637264FCA5AAF35xxxx" |
extendInfo | String | No | Indicates the extended information about this API.
| copy
|
Response parameters
Field | Data type | Required | Description | Example |
result | Yes | Indicates the request result such as status and error codes. | copy
| |
userInfo | No | Indicates the user information that the merchant queried. Note:
| See Response sample for details. |
Result process logic
In the response, the result.resultStatus field indicates the result of processing a request. The following table describes each result status:
Result status | Description |
S | The inquiry is successful. Use the The corresponding result.resultCode is |
U | The status of the inquiry is unknown.  The corresponding result.resultCode is |
F | The inquiry is failed. The corresponding result.resultCode and result.resultMessage are various based on different situations. For details, see the following Error codes section. |
Error codes
Error codes are usually classified into the following categories:
- Common error codes are common for all mini program OpenAPIs in V1. Â
- API-specific error codes: are listed in the following table.
Error code | Result status | Error message | Further action |
INVALID_ACCESS_TOKEN | F | The access token is not valid. | Obtain a new authorization code via the my.getAuthCode JSAPI and then get a valid access token with the authorization code via the /v1/authorizations/applyToken API. |
EXPIRED_ACCESS_TOKEN | F | The access token is expired. | Obtain a new access token with a refresh token via the /v1/authorizations/applyToken API. |
Samples
The data flow of inquiring about a user's information is illustrated as below:
- The Mini Program calls the my.getAuthCode JSAPI with specific scopes to request an authorization code.
- The E-wallet App processes the request and displays the authorization page that needs to be authorized.
- The user confirms the authorization in the super app.
- The E-wallet App service calls authorization service to processes the authorization information.
- The E-wallet backend verifies the authorization information, generates the authCode and returns.
- The E-wallet App service returns the authCode to the Mini Program.
- The Mini Program sends the authCode to the merchant backend.
- The merchant backend calls the applyToken API with authCode to apply the accessToken.
- The E-wallet backend returns accessToken information to the merchant backend, such as accessToken, refreshToken, etc.
- The merchant backend calls this API with the accessToken to inquire about the user's information.
- The E-wallet backend returns the user's information based on the scopes of the accessToken(Step 11).
Request
{
"accessToken": "281010033AB2F588D14B43238637264FCA5AAF35xxxx",
}
The merchant uses the access token (281010033AB2F588D14B43238637264FCA5AAF35xxxx
) to access the user's specific information.
Response
{
"result": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success"
},
"userInfo": {
"userId": "1000001119398804",
"loginIdInfos": [
{
"loginId": "",
"hashLoginId": "",
"maskLoginId": "",
"loginIdType": "MOBILE_PHONE"
}
],
"userName": {
"fullName": "Jack Second Third Sparrow",
"firstName": "Jack",
"secondName": "Second",
"thirdName": "Third",
"lastName": "Sparrow"
},
"userNameInArabic": {
"fullName": "Jack Second Third Sparrow",
"firstName": "Jack",
"secondName": "Second",
"thirdName": "Third",
"lastName": "Sparrow"
},
"avatar": "http://example.com/avatar.htm?avatarId=FBF16F91-28FB-47EC-B9BE-27B285C23CD3",
"gender": "M",
"birthDate": "2020-07-25",
"nationality": "IRQ",
"contactInfos": [
{
"contactType": "MOBILE_PHONE",
"contactNo": ""
}
]
}
}
- result.resultStatus is
S
, which means the inquiry request is successful. - userInfo describes the user's information you get via the inquiryUserInfo API. The information includes userId, status, userName, avatar, gender, birthDate, nationality, loginIdInfos, contactInfos, and extendInfo.