APIs Related to Construction Worker Management

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

Construction staff management. The construction staff can log in the Smart Engineering APP or the construction SDK to carry out construction, equipment distribution network, equipment maintenance and other operations in the room.

API List

Request method API description
GET /v1.0/osaas/construction/workers API for Querying the Construction Worker List.
POST /v1.0/osaas/construction/worker API for Adding a Construction Worker.
DELETE /v1.0/osaas/construction/workers/{worker_id} API for Deleting a Construction Worker.

API for Querying the Construction Worker List

API Description

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

API Address

GET /v1.0/osaas/construction/workers

Request Parameters

Parameter Type Position Description Mandatory
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 Worker list.

Parameters in workers

Parameter Type Description
worker_id String Unique ID of a worker.
username String Worker username.
nickname String Worker nickname.

Request Example

GET {url}/v1.0/osaas/construction/workers?page_no=1&page_size=20

Success Response Example

{ "result": { "total": 1, "page_no": 1, "page_size": 20, "workers": [ { "worker_id": "130641181272348xxxx", "username": "test@tuya.com", "nickname": "Test worker" } ] }, "success": true, "t": 1572936751228 }

Failure Response Example

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

API for Adding a Construction Worker

API Description

You can use this API to add a construction worker.

API Address

POST /v1.0/osaas/construction/worker

Request Parameters

Parameter Type Position Description Mandatory
country_code String BODY Country code. 86: China Yes
username String BODY Worker username. Yes
nickname String BODY Worker nickname. 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 worker.

Request Example

POST {url}/v1.0/osaas/construction/worker
{ "country_code": "86", "username": "test@tuya.com", "nickname": "Test worker" }

Success Response Example

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

Failure Response Example

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

API for Deleting a Construction Worker

API Description

You can use this API to delete a construction worker.

API Address

DELETE /v1.0/osaas/construction/workers/{worker_id}

Request Parameters

Parameter Type Position Description Mandatory
worker_id String URI Unique ID of an worker. 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/construction/workers/13064118127******

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