Authorize Persons

Last Updated on : 2023-01-12 07:16:16download

API list

Request method API Description
GET /v1.0/iot-02/building/access-auth-rules/actions/list-auth-structure Get the authorized organization tree
GET /v1.0/iot-02/building/access-auth-rules/actions/match-auth-structure Query the authorized organization by name
GET /v1.0/iot-02/building/access-auth-rules/actions/list-auth-person Get a list of the authorized persons
POST /v1.0/iot-02/building/access-auth-rules/actions/add-rules Add rules by organization, person, and person group
POST /v1.0/iot-02/building/access-auth-rules/actions/generate-auth Apply the rule with the specified authId
POST /v1.0/iot-02/building/access-auth-rules/actions/query-rules Query a list of authorization rules
PUT /v1.0/iot-02/building/access-auth-rules/actions/delete-by-source Delete permissions by organization and person
PUT /v1.0/iot-02/building/access-auth-rules/actions/edit-by-channels Edit the validity period by entrance and exit
PUT /v1.0/iot-02/building/access-auth-rules/actions/delete-by-channels Delete permissions by entrance and exit
GET /v1.0/iot-02/building/access-auth-rules/actions/channel-detail Get the details of an entrance and exit or a group

Get the authorized organization tree

Functional description

Get the authorized organization tree.

API endpoint

GET /v1.0/iot-02/building/access-auth-rules/actions/list-auth-structure

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. Yes
structureId String body The ID of the parent organization. Yes

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

[
  {
    "structureId": "String // The organization ID",
    "parentStructureId": "String // The ID of the parent organization. The value is null if no parent organization exists",
    "structureName": "String // The organization name",
    "level": "int // The level. A value of 0 represents the top level",
    "projectId": "String // The project ID. The project type shall have a value",
    "remark": "String // The remarks",
    "sort": "int // The sorting of a level",
    "externalNo": "String // The extension field used as an external number",
    "aliasCode": "String // The node code",
    "aliasCodePath": "String // The node codePath"
  }
]

Sample request

{
    "structureId":"1531473126917959***",
    "projectId":"1424615984265764***"
}

Sample response

[
  {
    "structureId": "The organization ID",
    "parentStructureId": "The ID of the parent organization. The value is null if no parent organization exists",
    "structureName": "The organization name",
    "level": "The level. A value of 0 represents the top level",
    "projectId": "The project ID. The project type shall have a value",
    "remark": "Remarks",
    "sort": "The sorting of a level",
    "externalNo": "The extension field used as an external number",
    "aliasCode": "The node code",
    "aliasCodePath": "The node codePath"
  }
]

Query the authorized organization by name

Functional description

Query the authorized assets by name. Fuzzy search is supported.

API endpoint

GET /v1.0/iot-02/building/access-auth-rules/actions/match-auth-structure

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. Yes
structureName String body The organization name. No

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

[
  {
    "structureId": "String // The organization ID",
    "parentStructureId": "String // The ID of the parent organization. The value is null if no parent organization exists",
    "structureName": "String // The organization name",
    "level": "int // The level. A value of 0 represents the top level",
    "projectId": "String // The project ID. The project type shall have a value",
    "remark": "String // The remarks",
    "sort": "int // The sorting of a level",
    "externalNo": "String // The extension field used as an external number",
    "aliasCode": "String // The node code",
    "aliasCodePath": "String // The node codePath"
  }
]

Sample request

{
  "structureName": "The organization name",
  "projectId": "The project ID"
}

Sample response

[
  {
    "structureId": "The organization ID",
    "parentStructureId": "The ID of the parent organization. The value is null if no parent organization exists",
    "structureName": "The organization name",
    "level": "The level. A value of 0 represents the top level",
    "projectId": "The project ID. The project type shall have a value",
    "remark": "Remarks",
    "sort": "The sorting of a level",
    "externalNo": "The extension field used as an external number",
    "aliasCode": "The node code",
    "aliasCodePath": "The node codePath"
  }
]

Get a list of the authorized persons

Functional description

Get a list of the authorized persons.

API endpoint

GET /v1.0/iot-02/building/access-auth-rules/actions/list-auth-person

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. Yes
name String body The name. No
personCode String body The work number of the specified person. No
page int body The total number of returned pages. Yes
pageSize int body The number of items returned on each page. Yes

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

{
  "total": "int",
  "list": [
    {
      "personId": "String // The ID of the specified person",
      "name": "String // The name",
      "personCode": "String // The work number of the specified person",
    }
  ],
  "hasMore": "boolean"
}

Sample request

{
  "name": "The name",
  "pageSize": "The number of items returned on each page",
  "page": "The total number of returned pages",
  "projectId": "The project ID",
  "personCode": "The work number of the specified person"
}

Sample response

{
    "result": {
        "list": [
            {
                "name": "Jane",
                "person_code": "1123",
                "person_id": "1564855972651077***"
            },
            {
                "name": "Tuya",
                "person_code": "",
                "person_id": "1563058569924837***"
            },
            {
                "name":"John",
                "person_code": "0123",
                "person_id": "1534731015270957***"
            },
            {
                "name": "Test 11",
                "person_code": "121212234",
                "person_id": "1523932734794235***"
            }
        ],
        "total": 4
    },
    "success": true,
    "t": 1664195281135,
    "tid": "a91153243d9611ed84fd2237f0528b74"
}

Add rules by organization, person, and person group

Functional description

Add rules by organization, person, and person group.

API endpoint

POST /v1.0/iot-02/building/access-auth-rules/actions/add-rules

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. Yes
authSourceType String body The authorization source. Valid values:
1: by organization
2: by person
3: by person group
Yes
authStartTime long body The time when the authorization becomes effective. No
authEndTime long body The time when the authorization expires. No
accessAuthTimeRangeId String body The accessible period. Currently, the default value of 1 indicates the authorization is always effective. In the future, the ID of the specified time period rule will be passed in. No
authIds String[] body A collection of the selected organizations, persons, and person groups. No
groupIds String[] body A collection of the selected entrance and exit group IDs. No
channelIds String[] body A collection of the selected entrance and exit IDs. Yes

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

String{}

Sample request

{
    "authStartTime":1661443200000,
    "authEndTime":2556115199000,
    "authIds":["1563057531880804***"],
    "groupIds":[],
    "authSourceType":"1",
    "channelIds":["1554305065534095***"],
    "accessAuthTimeRangeId":"1",
    "projectId":"1424615984265764***"
}

Sample response

{
    "result": "1574375617216917504",
    "success": true,
    "t": 1664195372302,
    "tid": "df6017e83d9611ed84fd2237f0528b74"
}

Apply the rule with the specified authId

Functional description

Apply the rule with the specified authId.

API endpoint

POST /v1.0/iot-02/building/access-auth-rules/actions/generate-auth

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. Yes
authSourceType String body The authorization source. Valid values:
1: by organization
2: by person
3: by person group
Yes
authId String body The organization ID or person ID. Yes

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

String{}

Sample request

{
  "authSourceType": "The authorization source. Valid values: 1: by organization, 2: by person, 3: by person group",
  "projectId": "The project ID",
  "authId": "The organization ID or person ID"
}

Sample response

String{}

Query a list of authorization rules

Functional description

Query a list of authorization rules.

API endpoint

POST /v1.0/iot-02/building/access-auth-rules/actions/query-rules

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. Yes
authId String body The ID of the specified organization, person, or group. No
relationType int body The search type. Valid values:
1: the entrance and exit group
2: the entrance and exit
No
relationName String body The name of the specified entrance and exit group, or the specified entrance and exit. No
page int body The total number of pages to be returned. Yes
pageSize int body The number of items to be returned on each page. Yes

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

{
  "total": "int",
  "list": [
    {
      "authRelationId": "String // The primary key ID of the authorization",
      "authId": "String // The ID of the specified organization, person, or group",
      "relationType": "int // The search type. Valid values: 1: the entrance and exit group. 2: the entrance and exit",
      "relationId": "String // The ID of the specified authorized entrance and exit, or entrance and exit group",
      "relationName": "String // The name of the specified authorized entrance and exit, or entrance and exit group",
      "accessAuthTimeRangeId": "String // The ID of the specified accessible period. Currently, the authorization is always effective by default.",
      "accessAuthTimeRangeStr": "String // The value of the specified accessible period. Currently, the authorization is always effective by default.",
      "authStartTime": "long // The time when the authorization takes effect",
      "authEndTime": "long // The time when the authorization expires",
    }
  ],
  "hasMore": "boolean"
}

Sample request

{
  "relationType": "The search type. Valid values: 1: the entrance and exit group. 2: the entrance and exit",
  "relationName": "The name of the specified authorized entrance and exit, or entrance and exit group",
  "pageSize": "The number of items returned on each page",
  "page": "The total number of returned pages",
  "projectId": "The project ID",
  "authId": "The ID of the specified organization, person, or group",
}

Sample response

{
  "total": "int",
  "list": [
    {
      "list": "The time when the authorization expires"
    }
  ],
  "hasMore": "boolean"
}

Delete permissions by organization and person

Functional description

Delete permissions by organization and person.

API endpoint

PUT /v1.0/iot-02/building/access-auth-rules/actions/delete-by-source

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. Yes
authSourceType String body The authorization source. Valid values:
1: by organization
2: by person
3: by person group
Yes
authId String body The organization ID. Yes

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

String{}

Sample request

{
  "authSourceType": "The authorization source. Valid values: 1: by organization, 2: by person, 3: by person group",
  "projectId": "The project ID",
  "authId": "The ID of the specified organization, person, or group",
}

Sample response

String{}

Edit the validity period by entrance and exit

Functional description

Edit the validity period by entrance and exit.

API endpoint

PUT /v1.0/iot-02/building/access-auth-rules/actions/edit-by-channels

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. Yes
authId String body The ID of the specified organization or person. Yes
authSourceType String body The authorization source. Valid values:
1: by organization
2: by person
3: by person group
No
authRelationIds String[] body The IDs of the authorization rules. No
authStartTime long body The time when the authorization becomes effective. No
authEndTime long body The time when the authorization expires. No

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

String{}

Sample request

{
  "authEndTime": "The time when the authorization expires",
  "authRelationIds": "The IDs of the authorization rules",
  "authStartTime": "The time when the authorization takes effect",
  "authSourceType": "The authorization source. Valid values: 1: by organization, 2: by person, 3: by person group",
  "projectId": "The project ID",
  "authId": "The organization ID or person ID"
}

Sample response

String{}

Delete permissions by entrance and exit

Functional description

Delete permissions by entrance and exit.

API endpoint

PUT /v1.0/iot-02/building/access-auth-rules/actions/delete-by-channels

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. Yes
authId String body The ID of the specified organization or person. Yes
authSourceType String body The authorization source. Valid values:
1: by organization
2: by person
3: by person group
No
authRelationIds String[] body The primary key IDs of the authorization. No

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

String{}

Sample request

{
  "authRelationIds": "The primary key IDs of the authorization",
  "authSourceType": "The authorization source. Valid values: 1: by organization, 2: by person, 3: by person group",
  "projectId": "The project ID",
  "authId": "The organization ID or person ID"
}

Sample response

String{}

Get the details of an entrance and exit or a group

Functional description

Get the details of an entrance and exit or a group.

API endpoint

GET /v1.0/iot-02/building/access-auth-rules/actions/channel-detail

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. Yes
authRelationId String body The primary key ID of the authorization. No
page int body The total number of pages to be returned. Yes
pageSize int body The number of items to be returned on each page. Yes

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

{
  "accessAuthTimeRangeId": "String // The ID of the specified accessible period. Currently, the authorization is always effective by default.",
  "accessAuthTimeRangeStr": "String // The value of the specified accessible period. Currently, the authorization is always effective by default.",
  "total": "int // The total number",
  "channelListVOList": [
    {
      "relationId": "String // The ID of the specified authorized entrance and exit, or person",
      "accessControlChannelName": "String // The name of the specified entrance and exit",
      "accessControlChannelNo": "String // The channel number of the specified entrance and exit",
      "accessChannelRoomId": "String // The ID of the specified installation area",
      "accessChannelPositionPath": "String // The name of the specified installation area",
      "businessDeviceId": "String // The device ID",
      "businessDeviceName": "String // The device name"
    }
  ]
}

Sample request

{
  "pageSize": "The number of items to be returned on each page",
  "page": "The total number of pages to be returned",
  "projectId": "The project ID",
  "authRelationId": "The primary key ID of the authorization",
}

Sample response

{
  "accessAuthTimeRangeId": "The ID of the specified accessible period. Currently, the authorization is always effective by default.",
  "accessAuthTimeRangeStr": "The value of the specified accessible period. Currently, the authorization is always effective by default.",
  "total": "The total number",
  "channelListVOList": [
    {
      "channelListVOList": "The device name"
    }
  ]
}

Error codes

The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.

Error code Description
500 A system error has occurred while processing your request.