Construction Management

Last Updated on : 2024-06-07 07:08:02download

This topic describes the API operations that are used to send construction tasks.

Request method API endpoint Description
POST /v2.0/illumination/construction/record Create a construction authorization record
GET /v2.0/illumination/construction/task/rooms Query the list of space construction information
GET /v2.0/illumination/construction/task/records Query the list of construction task authorization records
GET /v2.0/illumination/construction/task/record
/{recordId}
Get the details of construction task authorization records
DELETE /v2.0/illumination/construction/task/cancel
Authorization/{recordId}
Cancel a construction authorization

Create a construction authorization record

API description

Create a construction authorization record.

API endpoint

POST /v2.0/illumination/construction/record

Request parameter

Name Type Location Description Required
requestType int body The request type Yes
recordId String body The ID of an authorization record No
projectId String body The project ID Yes
userAccount String body The operator’s mobile phone number or email address Yes
countryCode String body Country code Yes
operatorName String body The operator’s name Yes
deviceTypes int[] body The types of construction devices.
  • 0: smart light
  • 1: gateway
  • 3: switch
  • 4: sensor
No
startTime long body The start time of construction Yes
endTime long body The end time of construction Yes
remark String body Remark No
roomIds String[] body The list of room IDs No

Return parameter

Name Type Description
code Integer Response code. For more information, see the error code section. It is empty when the operation succeeded.
success Boolean Indicate whether the operation succeeds.
  • true: succeeded.
  • false: failed.
msg String The error message that is returned if the request fails. It is empty if the request is successful.
t Long The returned 13-bit timestamp.
result Object The request result.

Description of result

{
  "recordId": "String // The ID of an authorization record",
  "success": "boolean"
}

Sample request

{
    "roomIds":[
        "136678083547004****"
    ],
    "requestType":1,
    "countryCode":"86",
    "userAccount":"china***@***mail.com",
    "remark":"Test",
    "endTime":1615046460000,
    "operatorName":"James",
    "projectId":"133336182632647****"
}

Sample response

{
  "recordId": "120684995791562****",
  "success":true
}

Query the list of space construction information

API description

Query the list of space construction information.

API endpoint

GET /v2.0/illumination/construction/task/rooms

Request parameter

Name
Type
Location
Description
Required
page int body The page number starting from 1. Yes
pageSize int body The number of entries per page. Valid values: 0 to 100. Yes
projectId String body The required project ID in the filter criteria. If a project is not created, set the value to an empty string. Yes
authorizationStatus String[] body Authorization status:
  • 0: unauthorized
  • 1: authorized
  • 2: expired
No
roomName String body The room name in the filter criteria. No

Return parameter

Name Type Description
code Integer Response code. For more information, see the error code section. It is empty when the operation succeeded.
success Boolean Indicate whether the operation succeeds.
  • true: succeeded.
  • false: failed.
msg String The error message that is returned if the request fails. It is empty if the request is successful.
t Long The returned 13-bit timestamp.
result Object The request result.

Description of result

{
  "total": "int",
  "list": [
    {
      "roomId": "String // The room ID",
      "roomName": "String // The room name",
      "roomType":"int // The room type. `2` means a floor, and `4` means a room. If the frontend gets `4` for this field, it means the bottom level."
      "deviceCountOnline": "int // The number of online devices",
      "taskStatus": "int // The task status. `0`: The task is not assigned. `1`: The construction is not started. `2`: The construction is in progress. `3`: The construction has been completed. `4`: The construction is postponed",
      "authorizationStatus": "int // The authorization status. `0`: The construction is not authorized. `1`: The authorization is in progress. `2`: The authorization has expired. `3`: The authorization is canceled",
      "recordId": "String // The ID of an authorization record. If no construction task is not created for this room, this field is not passed to the frontend",
      "taskId": "String // The ID of a task. If no construction task is created for this room, this field is not passed to the frontend",
      "deviceCountConstruction": "long // The number of devices that will be used for construction",
      "deviceCountFinish": "int // The number of devices that have completed the construction",
      "roomExtendId": "long // The ID of the room extension information"
    }
  ]
}

Sample request

{
  "pageSize": "10",
  "page": "1",
  "projectId": "135861962678679****",
  "authorizationStatus": "0",
  "taskStatus": "1",
  "roomName": ""
}

Sample response

{
    "list":[
        {
            "authorizationStatus":0,
            "deviceCountOnline":0,
            "roomId":"136454967987810****",
            "roomName":"cd"
        },
        {
            "authorizationStatus":0,
            "deviceCountOnline":0,
            "roomId":"136376023104097****",
            "roomName":"Room 3"
        },
        {
            "authorizationStatus":0,
            "deviceCountOnline":0,
            "roomId":"135865913932409****",
            "roomName":"Room 1"
        }
    ],
    "total":8
}

Query the list of construction task authorization records

API description

Query the list of construction task authorization records, which is available in v1.5.0 and later.

API endpoint

GET /v2.0/illumination/construction/task/records

Request parameter

Name
Type
Location
Description
Required
page int body The page number starting from 1 Yes
pageSize int body The number of entries per page. Valid values: 0 to 100 Yes
projectId String body The required project ID in the filter criteria. If a project is not created, set the value to an empty string. Yes
authorizationStatus String[] body Authorization status:
  • 0: unauthorized
  • 1: authorized
  • 2: expired
No
operatorName String body The operator in the filter criteria No
startTime long body The start time of construction in the filter criteria No
endTime long body The end time of construction in the filter criteria No

Return parameter

Name Type Description
code Integer Response code. For more information, see the error code section. It is empty when the operation succeeded.
success Boolean Indicate whether the operation succeeds.
  • true: succeeded.
  • false: failed.
msg String The error message that is returned if the request fails. It is empty if the request is successful.
t Long The returned 13-bit timestamp.
result Object The request result.

Description of result

{
  "total": "int",
  "list": [
    {
      "recordId": "String // The ID of an authorization record",
      "taskNum": "String // The task number",
      "userAccount": "String // The operator's mobile phone number or email address",
      "countryCode": "String // The country code",
      "operatorName": "String // The operator's name",
      "operatorUid": "String // The operator's UID",
      "address": "String // The installation location",
      "startTime": "long // The start time of construction",
      "endTime": "long // The end time of construction",
      "deviceCount": "int // The number of construction devices",
      "taskStatus": "int // The task status. `1`: The construction is not started. `2`: The construction is in progress. `3`: The construction has been completed. `4`: The construction is postponed",
      "authorizationStatus": "int // The authorization status. `0`: The construction is not authorized. `1`: The authorization is in progress. `2`: The authorization has expired. `3`: The authorization is canceled",
      "roomName": "String[] // The name of the construction space",
      "deviceCountFinish": "int // The number of devices that have completed the construction"
    }
  ]
}

Sample request

{
  "pageSize": "10",
  "page": "1",
  "startTime": "1614817212134",
  "endTime": "1614827801047",
  "projectId": "135861962678679****",
  "operatorName": "",
  "taskStatus": "1"
}

Sample response

{
    "list":[
        {
            "authorizationStatus":1,
            "deviceCountFinish":0,
            "endTime":1615564799999,
            "operatorName":"Test",
            "recordId":"1367313487243620352",
            "roomName":[
                "Room 2"
            ],
            "startTime":1614827914626,
            "userAccount":"18655286****"
        }
    ],
    "total":1
}

Get the details of construction task authorization records

API description

Get the details of construction task authorization records.

API endpoint

GET /v2.0/illumination/construction/task/record/{recordId}

Request parameter

Name Type Location Description Required
recordId String url The ID of a record Yes

Return parameter

Name Type Description
code Integer Response code. For more information, see the error code section. It is empty when the operation succeeded.
success Boolean Indicate whether the operation succeeds.
  • true: succeeded.
  • false: failed.
msg String The error message that is returned if the request fails. It is empty if the request is successful.
t Long The returned 13-bit timestamp.
result Object The request result.

Description of result

{
 "projectId": "String // The project ID",
  "recordId": "String // The ID of an authorization record",
  "taskNum": "String // The task number",
  "userAccount": "String // The operator's mobile phone number or email address",
  "countryCode": "String // The country code",
  "operatorName": "String // The operator's name",
  "address": "String // The installation location",
  "startTime": "long // The start time of construction",
  "endTime": "long // The end time of construction",
  "deviceCountFinish": "int // The number of devices that have been installed",
  "deviceCountTotal": "int // The total number of construction devices",
  "roomCountFinish": "int // The number of rooms where the construction has been completed",
  "roomCountTotal": "int // The total number of rooms",
  "taskStatus": "int // The task status. `1`: The construction is not started. `2`: The construction is in progress. `3`: The construction has been completed. `4`: The construction is postponed",
  "authorizationStatus": "int // The authorization status. `0`: The construction is not authorized. `1`: The authorization is in progress. `2`: The authorization has expired. `3`: The authorization is canceled",
  "remark": "String // Remarks",
  "rooms": [
    {
      "roomId": "String // The room ID",
      "roomName": "String // The room name",
      "roomType":"int // The room type. `2` means a floor, and `4` means a room. If the frontend gets `4` for this field, it means the bottom level."
      "deviceCountOnline": "int // The number of online devices",
      "taskStatus": "int // The task status. `0`: The task is not assigned. `1`: The construction is not started. `2`: The construction is in progress. `3`: The construction has been completed. `4`: The construction is postponed",
      "authorizationStatus": "int // The authorization status. `0`: The construction is not authorized. `1`: The authorization is in progress. `2`: The authorization has expired. `3`: The authorization is canceled",
      "recordId": "String // The ID of an authorization record. If no construction task is not created for this room, this field is not passed to the frontend",
      "taskId": "String // The ID of a task. If no construction task is created for this room, this field is not passed to the frontend",
      "deviceCountConstruction": "long // The number of devices that will be used for construction",
      "deviceCountFinish": "int // The number of devices that have completed the construction",
      "roomExtendId": "long // The ID of the room extension information"
    }
  ],
  "deviceTypes": [
    {
      "id": "int",
      "name": "String"
    }
  ]
}

Sample request

{
  "recordId": "1367313487243620352"
 }

Sample response

{
    "result":{
        "authorizationStatus":1,
        "countryCode":"86",
        "endTime":1615564799999,
        "operatorName":"Test",
        "recordId":"136731348724362****",
        "remark":"",
        "rooms":[
            {
                "deviceCountFinish":0,
                "roomId":"135861997159213****",
                "roomName":"Room 2"
            }
        ],
        "startTime":1614827914626,
        "userAccount":"1865528****"
    },
    "success":true,
    "t":1614828003226
}

Cancel a construction authorization

API description

Cancel a construction authorization.

API endpoint

DELETE /v2.0/illumination/construction/task/cancelAuthorization/{recordId}

Request parameter

Name Type Location Description Required
recordId String url The ID of an authorization record No

Return parameter

Name Type Description
code Integer Response code. For more information, see the error code section. It is empty when the operation succeeded.
success Boolean Indicate whether the operation succeeds.
  • true: succeeded.
  • false: failed.
msg String The error message that is returned if the request fails. It is empty if the request is successful.
t Long The returned 13-bit timestamp.
result Object The request result.

Description of result

{
  "success": "boolean"
}

Sample request

{
  "recordId": "136731348724362****"
}

Sample response

{
    "result":{
        "success":true
    },
    "success":true,
    "t":1614828114641
}

Error code

The following are common service exceptions for this API. For more exception errors, see Error Code.

Error code Description
500 The error message is returned because a system error has occurred.
1106 The error message is returned because you are not authorized to make the API request.