Add Person

Last Updated on : 2023-06-20 14:54:10download

Send an adding command to a specified access control device to add the information about a specified person.

API address

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

Request parameter

Parameter nameTypeINRequiredDescription
device_idStringuritrueThe ID of a Tuya device.
person_idStringuritrueThe ID of a specified person.

Description of body

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

Description of door_time_rule_list

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

Return parameter

Parameter nameTypeDescription
resultCmdIssueResultResponseThe returned result.

Description of result

Parameter nameTypeDescription
snStringThe ID of a specified command record.

Request example

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

Return example

{
    "result": {
        "sn": "133****"
    },
    "t": 1561456817168,
    "success": true
}

Error code

For more information, see error code.