APIs Related to Construction Template Management

Last Updated on : 2021-04-22 10:21:38Copy for LLMView as MarkdownDownload PDF

Construction template management, used to create template construction tasks, template can be configured to install equipment category and location.

API List

Request method API description
GET /v1.0/osaas/projects/{project_id}/construction/templates API for Querying the Construction Template List.
GET /v1.0/osaas/projects/{project_id}/construction/templates/{template_id} API for Obtaining Construction Template Details.
POST /v1.0/osaas/projects/{project_id}/construction/template API for Adding a Construction Template.
PUT /v1.0/osaas/projects/{project_id}/construction/templates/{template_id} API for Modifying Project Construction template.
POST /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/replication API for copy Project Construction Template.
DELETE /v1.0/osaas/projects/{project_id}/construction/templates/{template_id} API for Deleting a Construction Template.
POST /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/area API for Adding a Construction Template Area.
PUT /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/areas/{area_id} API for Modifying Construction Template Area Information.
DELETE /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/areas/{area_id} API for Deleting a Construction Template Area.
POST /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/areas/{area_id}/position API for Adding a Construction Template Device Installation Position.
PUT /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/areas/{area_id}/positions/{position_id} API for Modifying Construction Template Device Installation Position.
DELETE /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/areas/{area_id}/positions/{position_id} API for Deleting a Construction Template Device Installation Position.

API for Querying the Construction Template List

API Description

API for Querying the Construction Template List.

API Address

GET /v1.0/osaas/projects/{project_id}/construction/templates

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project Yes
page_no Integer URL Page number. No
page_size Integer URL Number of records on a page, which is greater than 0 and less than 100. No

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Object Result object.

Parameters in result

Parameter Type Description
total Integer Number of records on a page.
page_no Integer Total number of records.
page_size Integer Page number.
templates Arrays construction template set.

Parameters in templates

Parameter Type Description
template_id String Unique ID of a template.
template_name String Template name.
description String description
has_binding Boolean Whether to bind.
true:bound
false:unbound

Request Example

GET {url}/v1.0/osaas/projects/1239896663221xx/construction/templates

Success Response Example

{ "success": true, "t": 1539776581583, "result": { "page_no": 1, "page_size": 20, "total": 1, "templates": [ { "template_id": "1429018", "template_name": "Test Template", "description": "Test", "has_binding": true } ] } }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Obtaining Construction Template Details

API Description

API for Obtaining Construction Template Details.

API Address

GET /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
template_id String URI Unique ID of a template. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Object Construction template details.

Parameters in result

Parameter Type Description
template_id String Unique ID of a template.
template_name String Template name.
description String description.
has_binding Boolean Whether to bind. true:bound false:unbound
areas Array List of areas.

Parameters in areas

Parameter Type Description
template_id String Unique ID of a area.
area_name String Area name.
positions Arrays List of positions.

Parameters in positions

Parameter Type Description
position_id String Unique ID of a position.
position_name String Position name.
custom_device_name String Custom device name.
construction_category Array List of split devices.
infrared_devices Arrays List of infrared devices.

Parameters in split_devices

Parameter Type Description
category_code String Split device category code.
custom_device_name String Custom device name.

Parameters in infrared_devices

Parameter Type Description
category_id String Unique ID of a infrared device category.
custom_device_name String Custom device name.
brand_id String Unique ID of a infrared brand.
operator_id String Unique ID of a operator.
remote String Remote control index.

Request Example

GET {url}/v1.0/osaas/projects/1239896663221xx/construction/templates/1239xx

Success Response Example

{ "result": { "areas": [ { "area_id": "6UN******", "area_name": "Living room", "positions": [ { "construction_category": "wf_wnykq", "custom_device_name": "Universal remote control", "infrared_devices": [ { "area_id": "120116", "brand_id": "2", "category_id": "1", "operator_id": "3170", "remote": "4469" } ], "position_id": "************", "position_name": "position 1" }, { "construction_category": "zig_kg_1", "custom_device_name": "Switch", "position_id": "************", "position_name": "position 2", "split_devices": [ { "category_code": "dj", "custom_device_name": "Lamp" } ] } ] } ], "description": "Test", "has_binding": false, "template_id": "************", "template_name": "Test Template" } "success": true, "t": 1600670418686 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Adding a Construction Template

API Description

API for Adding a Construction Template

API Address

POST /v1.0/osaas/projects/{project_id}/construction/template

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project Yes
template_name String BODY Template name. Yes
description String BODY description. No

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result String Construction Unique ID of a template.

Request Example

POST {url}/v1.0/osaas/projects/12398966******/construction/template
{ "template_name": "Template name.", "description": "description.", }

Success Response Example

{ "success": true, "result":"142******", "t": 1566053034624 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Modifying Project Construction template

API Description

API for Modifying Project Construction template

API Address

PUT /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project Yes
template_id String URI Unique ID of a template. Yes
template_name String BODY Template name. No
description String BODY description. No

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Request Example

PUT {url}/v1.0/osaas/projects/123989666******/construction/templates/151xx
{ "template_name": "Template name.", "description": "description." }

Success Response Example

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

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for copy Project Construction Template

API Description

API for copy Project Construction Template

API Address

POST /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/replication

Request Parameters

Parameter Type Position Description Mandatory
project_id string URI Unique ID of a project Yes
template_id string URI Unique ID of a template. Yes
template_name string BODY Template name. Yes
description string BODY description. No

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Request Example

POST {url}/v1.0/osaas/projects/12398966******/construction/templates/157******/replication
{ "description": "Test", "template_name": "Test Template 2" }

Success Response Example

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

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Deleting a Construction Template

API Description

API for Deleting a Construction Template

API Address

DELETE /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project Yes
template_id String URI Unique ID of a template. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Request Example

DELETE {url}/v1.0/osaas/projects/1239896******/construction/templates/157***

Success Response Example

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

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Adding a Construction Template Area

API Description

You can use this API to add a construction template area.

API Address

POST /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/area

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project Yes
template_id String URI Unique ID of a template. Yes
area_name String BODY Area name. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Object Unique ID of a template.

Request Example

POST /v1.0/osaas/projects/12398966******/construction/templates/142***/area
{ "areaName": "Area name.", "templateId": "Unique ID of a template.", "projectId": "Unique ID of a project" }

Success Response Example

{ "success": true, "result": "ifNS***", "t": 1566053034624 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Modifying Construction Template Area Information

API Description

API for Modifying Construction Template Area Information.

API Address

PUT /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/areas/{area_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
template_id String URI Unique ID of a template. Yes
area_id String URI Unique ID of a area. Yes
area_name String BODY Area name. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Request Example

PUT {url}/v1.0/osaas/projects/123989666***/construction/templates/142***/areas/ifNS***
{ "area_name": "Area name." }

Success Response Example

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

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Deleting a Construction Template Area

API Description

API for Deleting a Construction Template Area

API Address

DELETE /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/areas/{area_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
template_id String URI Unique ID of a template. Yes
area_id String URI Unique ID of a area. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Request Example

DELETE {url}/v1.0/osaas/projects/1239896******/construction/templates/142***/areas/ifNS***

Success Response Example

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

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Adding a Construction Template Device Installation Position

API Description

API for Adding a Construction Template Device Installation Position

API Address

POST /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/areas/{area_id}/position

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
template_id String URI Unique ID of a template. Yes
area_id String URI Unique ID of a area. Yes
position_name String BODY Position name. Yes
construction_category String BODY Construction category. Yes
custom_device_name String BODY Custom device name. Yes
split_devices Arrays BODY List of split devices. No
infrared_devices Arrays BODY List of infrared devices. No

Parameters in split_devices

Parameter Type Position Description Mandatory
category_code String BODY Split device category code(refer to construction category chapter). Yes
custom_device_name String BODY Custom device name. Yes

Parameters in infrared_devices

Parameter Type Position Description Mandatory
category_id String BODY Unique ID of a infrared device category(Refer to the Construction Category chapter). Yes
custom_device_name String BODY Custom device name. Yes
brand_id String BODY Unique ID of a infrared device brand(Refer to the Universal Infrared chapter). Yes
remote String BODY Custom device name. Yes
area_id String BODY Unique ID of a area. No
operator_id String BODY Unique ID of a operator. No

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result String Unique ID of a position.

Request Example

POST {url}/v1.0/osaas/projects/1239896******/construction/templates/157***/areas/7Xh4g***/position
{ "construction_category": "zig_kg_1", "custom_device_name": "Switch", "position_name": "position 2", "split_devices": [ { "custom_device_name": "Lamp", "category_code": "dj" } ] }

Success Response Example

{ "success": true, "result":"233******", "t": 1566053034624 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Modifying Construction Template Device Installation Position

API Description

API for Modifying Construction Template Device Installation Position

API Address

PUT /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/areas/{area_id}/positions/{position_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
template_id String URI Unique ID of a template. Yes
area_id String URI Unique ID of a area. Yes
position_id String URI Unique ID of a position. Yes
position_name String BODY Position name. Yes
construction_category String BODY Construction category. Yes
custom_device_name String BODY Custom device name Yes
split_devices Arrays BODY List of split devices. No
construction_category Arrays BODY List of infrared devices. No

Parameters in split_devices

Parameter Type Position Description Mandatory
category_code String BODY Split device category code(refer to construction category chapter). Yes
custom_device_name String BODY Custom device name Yes

Parameters in infrared_devices

Parameter Type Position Description Mandatory
category_id String BODY Unique ID of a infrared device category(Refer to the Construction Category chapter). Yes
custom_device_name String BODY Custom device name. Yes
brand_id String BODY Unique ID of a infrared device brand(Refer to the Universal Infrared chapter). Yes
remote String BODY Custom device name. Yes
area_id String BODY Unique ID of a area. No
operator_id String BODY Unique ID of a operator. No

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Request Example

PUT {url}/v1.0/osaas/projects/123989666******/construction/templates/157 ***/areas/7Xh4g***/positions/1316367637******
{
  "construction_category": "zig_kg_1",
  "custom_device_name": "Switch",
  "position_name": "position 2",
  "split_devices": [
    {
      "custom_device_name": "Lamp",
      "category_code": "dj"
    }
  ]
}

Success Response Example

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

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Deleting a Construction Template Device Installation Position

API Description

API for Deleting a Construction Template Device Installation Position

API Address

DELETE /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/areas/{area_id}/positions/{position_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
template_id String URI Unique ID of a template. Yes
area_id String URI Unique ID of a area. Yes
position_id String URI Unique ID of a position. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Success Response Example

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

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

Request Example

DELETE {url}/v1.0/osaas/projects/123989666******/construction/templates/157***/areas/7Xh4g***/positions/1316367637******

Success Response Example

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

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

Error Code

The following are common business exceptions for this interface. For more exception errors, see Global Error Codes.

error code explain
500 system error