API Reference

Last Updated on : 2021-08-16 08:33:02download

This topic describes the APIs available for use in the smart data profile service.

API list

Request method API Description
GET /v1.0/user-profile/group/users Get information about users in a specified group
GET /v1.0/user-profile/user/tags Get detailed labels of a single user
GET /v1.0/user-profile/group/user/check Verify whether a user is in a group

Get information about users in groups

API description

Get the information about users in a specified group in the smart data profile service. User information includes the user ID, email address, mobile phone number, and more.

API endpoint

GET /v1.0/user-profile/group/users

Request parameter

Parameter Parameter type Required Description
bizType Integer Yes The domain of a specified app user.
groupId Integer Yes The ID of a specified group.
pageSize Integer No The number of entries to be returned on each page.
lastId Integer No The ID of the last entry on the previous page. The parameter value is required when you query the next page. If it is left blank, the first page will be queried by default.

Return parameter

Parameter Data type Description
code Integer See Global Error Codes.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: succeeded
  • false: failed
msg String The error message returned if the API call fails. This parameter value is empty if the API call succeeds.
result Object The returned result.


Result

Parameter Data type Description
resultDO List The list of users.

Sample request

GET /v1.0/user-profile/group/users?params={"bizType":2xxx32,"groupId":1xx,"pageSize":10,"lastId":"ay15xxxxxxxxwnass3"}

Sample response

{
    "result": {
        "resultDO": {
            "data": [
                {
                    "email": "",
                    "mobile": "86-15XXXXXX587",
                    "uid": "ay1xxxxxxx23101eifQI"
                },
                {
                    "email": "yuxixxxxx@tuya.com",
                    "mobile": "",
                    "uid": "ay157xxxxxx58yV66h"
                },
                {
                    "email": "zxxxx@tuya.com",
                    "mobile": "",
                    "uid": "ay15xxxxxxxxxx4fAYcu"
                }
            ],
            "lastUid": "ay15xxxxxxxxwnT43",
            "totalCount": 3
        },
        "success": true
    },
    "success": true,
    "t": 1628236323685
}

Get detailed labels of a single user

API description

Get label details of a single user.

API endpoint

GET /v1.0/user-profile/user/tags

Request parameter

Parameter Data type Required Description
bizType Integer Yes The domain of a specified app user.
tags Integer No The specific labels of a user can be returned. Refer to the labels in the smart data profile service. If it is left blank, no label details will be returned.
searchValue String Yes The keywords. It is used with searchType.
searchType Integer No Valid values:
  • 0: Search by account.
  • 1: Search by email address.
  • 2: Search by mobile phone number.
  • 3: Search by UID.
    Note: If no parameter is entered, the search by account will be performed by default.
  • isEn Boolean No Determine whether the content of the returned label details is in English. Valid values:
  • true: The content is displayed in English.
  • false: The content is displayed in Chinese.
    Note: If no parameter is entered, the content is displayed in Chinese by default.
  • Return parameter

    Parameter Data type Description
    code Integer See Global Error Codes.
    success Boolean Indicates whether the operation is successful. Valid values:
    • true: succeeded
    • false: failed
    msg String The error message returned if the API call fails. This parameter value is empty if the API call succeeds.
    result Object The returned result.

    Result

    Parameter Data type Description
    resultDO Map The specific label value of a user.

    Sample request

    GET /v1.0/user-profile/user/tags?params={"bizType":12xx27 ,"searchValue":"ay162xxxxxxxxJmfe","tags":["username","user_level","city_cn"],"searchType":3,"isEn":false}
    

    Sample response

    {
        "result": {
            "resultDO": {
                "city_cn": "Hangzhou",
                "user_level": "Elementary user",
                "username": "yxxxxx@tuya.com"
            },
            "success": true
        },
        "success": true,
        "t": 1628236440462
    }
    

    Verify whether a user is in a group

    API description

    Verify whether a user is in a specified group.

    API endpoint

    GET /v1.0/user-profile/group/user/check
    

    Request parameter

    Parameter Data type Required Description
    bizType Integer Yes The domain of a specified app user.
    groupId Integer Yes The ID of a specified group.
    searchValue String Yes The keywords. It is used with searchType.
    searchType Integer No Valid values:
  • 0: Search by account.
  • 1: Search by email address.
  • 2: Search by mobile phone number.
  • 3: Search by UID.
    Note: If no parameter is entered, the search by account will be performed by default.
  • Return parameter

    Parameter Data type Description
    code Integer See Global Error Codes.
    success Boolean Indicates whether the operation is successful. Valid values:
    • true: succeeded
    • false: failed
    msg String The error message returned if the API call fails. This parameter value is empty if the API call succeeds.
    result Object The returned result.

    Result

    Parameter Data type Description
    resultDO Boolean Valid values:
  • true: The user is in a group.
  • false: The user is not in a group.
  • Sample request

    GET /v1.0/user-profile/group/user/check?params={"bizType":4xxx22,"groupId":9xx,"searchValue":"guxxxxx0153915","searchType":0}
    

    Sample response

    {
        "result": {
            "resultDO": true,
            "success": true
        },
        "success": true,
        "t": 1628236525772
    }