/v2/users/inquiryUserInfo

POST /v2/users/inquiryUserInfo

The inquiryUserInfo API is used for the merchant to get user-related information after obtaining user authorization.

Message structure

A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:

Request

Property

Data type

Required

Description

Example

accessToken

String

Yes

An access token that can be used to access the user resource scope.

Max. length: 128 characters

"281010033AB2F588D14B43238637264FCA5AAF35xxxx"

authClientId 

String

No

The unique auth client ID.

Max. length: 128 characters

"202016726873874774774xxxx"

extendInfo

String

No

The extended information that wallets and merchants want to describe.

Max. length: 4096 characters.

copy
{
    "memo": "memo"
}

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

User

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 follow:

resultStatus

Description 

S

It means user information inquiry is successful, merchants can use the accessToken to access the corresponding user resource scope.

The corresponding result.resultCode is "SUCCESS" and the  result.resultMessage  is "Success".

U

The API status is unknown.  AuthClient may guide a user to try again.

The corresponding result.resultCode is "UNKNOWN_EXCEPTION" and result.resultMessage  is "An API calling is failed, which is caused by unknown reasons.".

For details, see the Common error codes section.

F

It means that user information 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.  
  • API-specific error codes: are listed in the following table.

resultStatus

resultCode

resultMessage

Further Action

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.

Samples

Query user information via an access token. The access token is generated via OAuth after authorization is successful.

/v2/users/inquiryUserInfo
  1. Merchant calls this interface with the access token (Step 1)
  2. Wallet server returns user information the to merchant based on the access token (Step 2).

Request

copy
{
  "accessToken": "281010033AB2F588D14B43238637264FCA5AAF35xxxx",
  "authClientId": "202016726873874774774xxxx"
  
}

Response

copy
{
 "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": "{}"
  }
}