Sync Users

Last Updated on : 2023-06-01 06:20:14download

Sync the users. According to your own business scenarios, you can create accounts and modify account information as you want.

Note:
In the same application, if the same username is passed in, the last information of the user will be updated.
Currently, OEM apps only support mobile phone numbers and email addresses. The password hash rule is the MD5 algorithm.

API address

POST: /v1.0/apps/{schema}/user

Request parameter

Parameter name Type IN Required Description
schema String uri true App schema

Description of body

Parameter name Type IN Required Description
country_code String body true The country code.
username String body true The username.
password String body true The user’s password. You should use the original MD5 Hash password.
username_type Integer body true The type of username. Default value: 3. Valid values:
  • 1: mobile phone number.
  • 2: email address.
  • 3: others.
nick_name String body false The nickname of the user.
time_zone_id String body false The ID of a specified time zone.

Return parameter

Parameter name Type Description
result JSONObject The returned result of registering users.

Description of result

Parameter name Type Description
uid String Tuya user ID.

Request example

POST: /v1.0/apps/testApp/user
{
  "country_code": "86",
  "username": "182*****678",
  "password": "c7fb2740c5f******4ed765a479fa",
  "username_type": 1,
  "time_zone_id": "Asia/Shanghai"
}

Return example

{
    "result": {
        "uid": "ay1534*****4744oIAa"
    },
    "success": true
}

Error code

For more information, see error code.