Bulk Add Users

Last Updated on : 2023-06-15 05:24:57

Send an adding command to a specified access control device to add users in bulk.

API address

POST: /v1.0/access-control/{device_id}/persons

Request parameter

Parameter nameTypeINRequiredDescription
device_idStringuritrueThe ID of a Tuya device.

Description of body

Parameter nameTypeINRequiredDescription
person_listList trueThe list of users.

Description of person_list

Parameter nameTypeINRequiredDescription
person_idString trueThe ID of a specified user.
nameString falseThe name of a specified user.
id_cardString falseThe identity card number of the user.
phoneString falseThe mobile phone number.
person_floorInteger falseThe floor on which the user resides.
secret_keyString falseThe secret key of the user.
refresh_timeLong falseThe time when the QR code is refreshed. Unit: milliseconds.
begin_timeLong falseThe start time of the validity period. Unit: milliseconds.
end_timeLong falseThe end time of the validity period. Unit: milliseconds.
door_time_rule_listList falseThe time rule of a schedule.
extendString falseThe extension information.

Description of door_time_rule_list

Parameter nameTypeINRequiredDescription
rule_nameString falseThe name of the time rule.
periodString falseThe cycle when the access is allowed.
allowed_dateString falseThe time period when the access is allowed.
denied_dateString falseThe time period when the access is denied.

Return parameter

Parameter nameTypeDescription
resultCmdIssueBatchResultResponseThe returned result.

Description of result

Parameter nameTypeDescription
sn_listListThe command record ID.

Request example

POST: /v1.0/access-control/6ce****/persons
{
  "person_list": [
    {
      "person_id": "123****",
      "begin_time": 1582959882104,
      "end_time": 1661666512292,
      "id_card": "330****",
      "name": "zhangsan",
      "phone": "135****",
      "person_floor": 5,
      "secret_key": "abc234****",
      "refresh_time": 300000
    },
    {
      "person_id": "123****",
      "begin_time": 1582959882104,
      "end_time": 1661666512292,
      "id_card": "330****",
      "name": "zhangsan",
      "phone": "135****",
      "person_floor": 5,
      "secret_key": "abc234****",
      "refresh_time": 300000
    }
  ]
}

Return example

{
    "result": {
        "sn_list": [
            "133****",
            "132****"
        ]
    },
    "t": 1561456817168,
    "success": true
}

Error code

For more information, see error code.