APIs Related to Construction Task Management

Last Updated on : 2025-05-30 01:56:03download

Construction task management. After the construction task is created for the construction workers, the construction workers can carry out the construction network distribution equipment through the intelligent engineering APP or the self-developed app with the integrated construction SDK.

API List

Request method API Description
POST /v1.0/osaas/projects/{project_id}/construction/templates/{template_id}/task API for Creating a Template Construction Task.
GET /v1.0/osaas/projects/{project_id}/construction/tasks API for Querying the Construction Task List.
GET /v1.0/osaas/projects/{project_id}/construction/tasks/{task_id} API for Querying Construction Task Details.
POST /v1.0/osaas/projects/{project_id}/construction/tasks/{task_id}/reopen API for Reopening Construction Task.
POST /v1.0/osaas/projects/{project_id}/construction/tasks/{task_id}/acceptance API for Accepting Construction Task.
DELETE /v1.0/osaas/projects/{project_id}/construction/tasks/{task_id} API for Deleting a Construction Task.

API for Creating a Template Construction Task

API Description

You can use this API to create a template construction task.

API Address

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

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
room_ids String[] BODY List of unique IDs of rooms. Yes
worker_id String BODY Unique ID of a worker. Yes
template_constraint Boolean BODY Template constraints(all template positions must be construction with device, the default is false). 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 task.

Request Example

POST {url}/v1.0/osaas/projects/123382396505******/construction/templates/1160823******/task
{ "room_ids": [ "1160823965053******" ], "worker_id": "15673345******", "template_constraint": false }

Success Response Example

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

Failure Response Example

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

API for Querying the Construction Task List

API Description

You can use this API to query the construction task list.

API Address

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

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
page_no Integer URL Page number. The default value is 1. No
page_size Integer URL Number of records on a page, which is greater than 0 and less than 100. If this parameter is not set, the number is 20 by default. 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 Total number of records.
page_no Integer Page number.
page_size Integer Number of records on a page.
tasks Arrays Task list.

Parameters in tasks

Parameter Type Description
task_id String Unique ID of a task.
template_id String Unique ID of a template.
construction_ status String Construction status.
PENDING_CONSTRUCTION: to be constructed
IN_CONSTRUCTION: being constructed
PENDING_ACCEPTANCE: to be accepted
ACCEPTANCE_COMPLETE: accepted
worker_username String Worker username.
worker_nickname String Worker nickname.
gmt_create Long Creation time, which is a 13-digit timestamp.

Request Example

GET {url}/v1.0/osaas/projects/1233823965053******/construction/tasks?page_no=1&page_size=20

Success Response Example

{ "result": { "total": 1, "page_no": 1, "page_size": 20, "tasks": [ { "task_id": "130641181272348******", "template_id": "12554365357******", "worker_username": "test@tuya.com", "worker_nickname": "Tom", "construction_status": "PENDING_CONSTRUCTION", "gmt_create": 1600766546913 } ] }, "success": true, "t": 1572936751228 }

Failure Response Example

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

API for Querying Construction Task Details

API Description

You can use this API to query construction task details.

API Address

GET /v1.0/osaas/projects/{project_id}/construction/tasks/{task_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
task_id String URI Unique ID of a task. 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 Task details.

Parameters in result

Parameter Type Description
task_id String Unique ID of a task.
template_id String Unique ID of a template.
construction_ status String Construction status.
PENDING_CONSTRUCTION: to be constructed
IN_CONSTRUCTION: being constructed
PENDING_ACCEPTANCE: to be accepted
ACCEPTANCE_COMPLETE: accepted
worker_username String Worker username.
worker_nickname String Worker nickname.
gmt_create Long Creation time, which is a 13-digit timestamp.
room_ids Arrays List of unique IDs of rooms.

Request Example

GET {url}/v1.0/osaas/projects/12338239650******/construction/tasks/126770532******

Success Response Example

{ "result": { "task_id": "13064118127******", "template_id": "12******", "worker_username": "test@tuya.com", "worker_nickname": "Tom", "construction_status": "PENDING_CONSTRUCTION", "room_ids": [ "1255436535******" ], "gmt_create": 1600766546913 }, "success": true, "t": 1572936751228 }

Failure Response Example

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

API for Reopening Construction Task

API Description

You can use this API to reopen a construction task.

API Address

POST /v1.0/osaas/projects/{project_id}/construction/tasks/{task_id}/reopen

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
task_id String URI Unique ID of a task. 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 Result object.

Request Example

POST {url}/v1.0/osaas/projects/1233823965053******/construction/tasks/126770591******/reopen

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 Accepting Construction Task

API Description

You can use this API to accept a construction task.

API Address

POST /v1.0/osaas/projects/{project_id}/construction/tasks/{task_id}/acceptance

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
task_id String URI Unique ID of a task. 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 Result object.

Request Example

POST {url}/v1.0/osaas/projects/1233823965053******/construction/tasks/126770532******/acceptance

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 Task

API Description

You can use this API to delete a construction task.

API Address

DELETE /v1.0/osaas/projects/{project_id}/construction/tasks/{task_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
task_id String URI Unique ID of a task. 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 Result object.

Request Example

DELETE {url}/v1.0/osaas/projects/1233823965053******/construction/tasks/12677053******

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