Create Relationship Between Resident and House

Last Updated on : 2023-06-21 07:13:11download

Create a relationship between a resident and a house, such as the resident type and house information. A relationship ID is returned.

API address

POST: /v1.0/iot-02/community/room-user

Request parameter

Description of body

Parameter nameTypeINRequiredDescription
block_idString trueThe ID of a community.
householder_idString trueThe ID of a resident.
room_user_typeString trueThe type of resident.
  • HOUSEHOLDER: owner.
  • FAMILY: family member.
  • TENANT: tenant.
  • FRIEND: friend.
  • RELATIVES: relative
  • COLLEAGUE: colleague.
  • DECORATOR: decorator.
  • BABYSITTER: babysitter.
  • OTHER: others.
tree_idString trueThe space ID of a specified house node.
expire_dateString falseThe validity period. An empty value indicates that it is permanently valid.

Return parameter

Parameter nameTypeDescription
resultHighwayRoomUserOperateResponse

Description of result

Parameter nameTypeDescription
room_user_idStringThe ID of the relationship between a resident and a house.
successBooleanIndicates whether the operation is successful.
operationStringError cause.
  • Failed to create a resident.
  • Failed to edit a resident.
  • The system has automatically updated the resident information.
  • The resident already exists and is bound to the same house.
  • The mobile phone number already exists.
  • Cannot be added repeatedly.

Request example

POST: /v1.0/iot-02/community/room-user
{
  "block_id": "138258104436502xxxx",
  "room_user_type": "FAMILY",
  "householder_id": "138258104436502xxxx",
  "expire_date": 1621587021161,
  "tree_id": "138258404436502xxxx"
}

Return example

{
    "room_user_id": "136767399153950xxxx",
    "success": true
}

Error code

For more information, see error code.