APIs Related to Space Management

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

API List

Request method API description
POST /v1.0/osaas/projects/{project_id}/space API for Adding a Space
PUT /v1.0/osaas/projects/{project_id}/spaces/{space_id} API for Modifying Space Information
DELETE /v1.0/osaas/projects/{project_id}/spaces/{space_id} API for Deleting a Space
GET /v1.0/osaas/projects/{project_id}/spaces API for Querying the Space List

API for Adding a Space

API Description

You can use this API to add a space based on the unique ID of a project and the space name. The space name at one level is unique

API Address

POST /v1.0/osaas/projects/{project_id}/space

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
parent_space_id String BODY Unique ID of the parent space. If this parameter is not set, the space level is 1. No
space_name String BODY Name of a space, which contains a maximum of 32 characters. Yes
space_type String BODY Code of the space type. The values are as follows: PARK BUILDING UNIT FLOOR Yes
sort Integer BODY Subscript for sorting a space. The default value is 1 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 space.

Request Example

POST {url}/v1.0/osaas/projects/1160823965053******/space
{ "parent_space_id": "1236699939214******", "space_name": "5 floor", "space_type": "FLOOR" }

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 Modifying Space Information

API Description

You can use this API to modify information about a space based on the unique IDs of the project and the space.

API Address

PUT /v1.0/osaas/projects/{project_id}/spaces/{space_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
space_id String URI Unique ID of a space Yes
space_name String BODY Name of a space, which contains a maximum of 32 characters. No
sort Integer BODY Subscript for sorting a space 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/116289*******/spaces/11608239650****** 
{ "space_name": "5 floor" }

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 Space

API Description

You can use this API to delete a space based on the unique IDs of the project and the space. Existing rooms and space subnodes cannot be deleted.

API Address

DELETE /v1.0/osaas/projects/{project_id}/spaces/{space_id}

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
space_id String URI Unique ID of a space 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/116289xxxxx/spaces/116082305312xxxxx

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 Querying the Space List

API Description

You can use this API to query the space list based on the unique ID of a project.

API Address

GET /v1.0/osaas/projects/{project_id}/spaces

Request Parameters

Parameter Type Position Description Mandatory
project_id String URI Unique ID of a project. Yes
parent_space_id String URL Unique ID of the parent space. If this parameter is not set, the space list of level 1 under the project is queried. No
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 100 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.
spaces Arrays Space set.

Parameters in spaces

Parameter Type Description
space_id String Unique ID of a space.
space_name String Name of a space.
space_type String Type of a space
sort Integer Subscript for sorting a space.
gmt_create Long Creation time, which is a 13-digit timestamp
gmt_modified Long Modification time, which is a 13-digit timestamp

Request Example

GET {url}/v1.0/osaas/projects/11608239650531******/spaces

Success Response Example

{ "result": { "total": 1, "page_no": 1, "page_size": 100, "spaces": [ { "space_id": "1160823965053******", "space_name": "5 floor", "space_type": "FLOOR", "sort": 1, "gmt_create": 1559707046000, "gmt_modified": 1559707046000 } ] }, "success": true, "t": 1561381210234 }

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