APIs Related to Maintenance Task Management

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

Maintenance task management. After creating maintenance tasks for the construction workers, the construction workers can debug and repair the damaged equipment through the Smart Engineering APP or the self-developed app with the integrated construction SDK, or they can also distribute new equipment for the house network.

API List

Request method API description
POST /v1.0/osaas/projects/{project_id}/maintenance/task APIs Related to Maintenance Task Management.
GET /v1.0/osaas/projects/{project_id}/maintenance/tasks API for Querying the Maintenance Task List.
GET /v1.0/osaas/projects/{project_id}/maintenance/tasks/{task_id} API for Querying Maintenance Task Details.
POST /v1.0/osaas/projects/{project_id}/maintenance/tasks/{task_id}/reopen API for Reopening Maintenance Task.
POST /v1.0/osaas/projects/{project_id}/maintenance/tasks/{task_id}/acceptance API for Accepting Maintenance Task.
DELETE /v1.0/osaas/projects/{project_id}/maintenance/tasks/{task_id} API for Deleting a Maintenance Task.

API for Creating a Maintenance Task

API Description

You can use this API to create a maintenance task.

API Address

POST /v1.0/osaas/projects/{project_id}/maintenance/task

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
worker_id String BODY Unique ID of a worker. Yes
room_device_relations Arrays BODY List of room device relationships. Yes

Parameters in room_device_relations

Parameter Type Position Description Mandatory
room_id String BODY Unique ID of a room Yes
device_ids String[] BODY List of unique IDs of devices. 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 String Unique ID of a task.

Request Example

POST {url}/v1.0/osaas/projects/123382396505******/maintenance/task
{ "worker_id": "1306411812723******", "room_device_relations": [ { "room_id": "14526789650531******", "device_ids": [ "00122433******" ] } ] }

Success Response Example

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

Failure Response Example

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

API for Querying the Maintenance Task List

API Description

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

API Address

GET /v1.0/osaas/projects/{project_id}/maintenance/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.
construction_ status String Maintenance status.
PENDING_MAINTENANCE: to be maintained
IN_MAINTENANCE: being maintained
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/12338239650******/maintenance/tasks?page _no=1&page_size=20

Success Response Example

{ "result": { "total": 1, "page_no": 1, "page_size": 20, "tasks": [ { "task_id": "1306411812723******", "worker_username": "test@tuya.com", "worker_nickname": "Tom", "maintenance_status": "PENDING_ACCEPTANCE", "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 Maintenance Task Details

API Description

You can use this API to query maintenance task details.

API Address

GET /v1.0/osaas/projects/{project_id}/maintenance/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.
maintenance_ status String Maintenance status.
PENDING_MAINTENANCE: to be maintained
IN_MAINTENANCE: being maintained
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_device_relations Arrays List of room device relationships.

Parameters in room_device_relations

Parameter Type Description
room_id String Unique ID of a room.
device_ids Arrays List of unique IDs of devices.

Request Example

GET {url}/v1.0/osaas/projects/123382396505******/maintenance/tasks/1267705******

Success Response Example

{ "result": { "task_id": "1306411812723******", "worker_username": "test@tuya.com", "worker_nickname": "Tom", "construction_status": "PENDING_ACCEPTANCE", "gmt_create": 1600766546913, "room_device_relations": [ { "room_id": "145267896505******", "device_ids": [ "00122433******" ] } ] }, "success": true, "t": 1572936751228 }

Failure Response Example

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

API for Reopening Maintenance Task

API Description

You can use this API to reopen a maintenance task.

API Address

POST /v1.0/osaas/projects/{project_id}/maintenance/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 Operation result.

Request Example

POST {url}/v1.0/osaas/projects/123382396505******/maintenance/tasks/12677053******/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 Maintenance Task

API Description

You can use this API to accept a maintenance task.

API Address

POST /v1.0/osaas/projects/{project_id}/maintenance/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*******/maintenance/tasks/12677053******/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 Maintenance Task

API Description

You can use this API to delete a maintenance task.

API Address

DELETE /v1.0/osaas/projects/{project_id}/maintenance/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 Boolean Operation result.

Request Example

DELETE {url}/v1.0/osaas/projects/1233823965053******/maintenance/tasks/126770532******

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