English
English
简体中文
Contact Us
Register
Log In

Sync Users

Last Updated on : 2022-09-28 05:47:13download

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 nameTypeINRequiredDescription
schemaStringuritrueApp schema

Description of body

Parameter nameTypeINRequiredDescription
country_codeStringbodytrueThe country code.
usernameStringbodytrueThe username.
passwordStringbodytrueThe user's password. You should use the original MD5 Hash password.
username_typeIntegerbodytrueThe type of username. Default value: 3. Valid values:
  • 1: mobile phone number.
  • 2: email address.
  • 3: others.
nick_nameStringbodyfalseThe nickname of the user.
time_zone_idStringbodyfalseThe ID of a specified time zone.

Return parameter

Parameter nameTypeDescription
resultJSONObjectThe returned result of registering users.

Description of result

Parameter nameTypeDescription
uidStringTuya 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.