Property Hierarchy Management REST API Reference
Use the Property Hierarchy Management REST API to represent your property as a hierarchy of floors, units, and rooms.
The unit forms the building block of property hierarchy. You can create a unit under your organization to represent your property, and then create several units under it to represent rooms. You can also add more levels in your hierarchy. For example, you can create units under the property unit to represent floors in your property, and then create units under each floor unit to represent rooms on that floor. With the Create unit
operation, you can create up to 15 levels of units in your hierarchy to represent your property. You can't manage properties with more than two levels in the console. Instead, use the Property Hierarchy Management API to manage complex properties.
To configure unit settings, such as the default music station provider, see Unit Settings REST API Reference.
API endpoint
In the request header, set Host
to one of the following, depending on the region of your organization:
Country | Endpoint |
---|---|
CA, US |
|
DE, ES, FR, IT, UK |
|
JP |
|
Authentication
Each API request must have an authorization header whose value is the access token retrieved from Login with Amazon (LWA). For details, see Manage API Access.
Operations
The Property Hierarchy Management API includes the following operations.
Operation | HTTP Method and URI |
---|---|
| |
| |
| |
| |
|
Create unit
Create a unit to represent a physical property, floor, wing, or room.
A unit is an administrative construct for organizing people and resources that interact with Alexa systems. Units are hierarchical in nature and can have zero or more child units. The parent of a unit can't be any of its child units.
This operation is available in the following countries.
Healthcare | Hospitality | Senior Living | Core |
---|---|---|---|
US |
US, DE, IT, ES, JP |
CA, DE, FR, IT, UK, US, ES, JP |
US |
Request
To create a unit, you make a POST
request to the /v2/units
resource.
Request path and header example
POST /v2/units
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Header |
Access token for the customer. |
String |
Yes |
Request body example
{
"name": {
"type": "PLAIN",
"value": {
"text": "Room-100"
}
},
"parentId": "amzn1.alexa.unit.did.1"
}
Request body properties
Property | Description | Type | Required |
---|---|---|---|
|
Name of the unit. |
|
Yes |
|
Identifies the unit under which to create the new unit. |
String |
Yes |
Response
A successful response returns HTTP 200 OK
, along with newly created unit ID.
On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message.
Response body example
{
"id": "amzn1.alexa.unit.did.100"
}
Response body properties
Property | Description | Type |
---|---|---|
|
Identifies the new unit. |
String |
HTTP status codes
Status | Description |
---|---|
|
Response body contains new unit ID. |
|
Indicates that one or more properties in the request body aren't valid. |
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as the number of requests per unit of time, exceeded. You can retry the request by using exponential back-off. |
|
Error occurred on the server. You can retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Delete unit
Delete the specified unit. You can't delete a unit that has child units or associated endpoints.
This operation is available in the following countries.
Healthcare | Hospitality | Senior Living | Core |
---|---|---|---|
US |
US, DE, IT, ES, JP |
CA, DE, FR, IT, UK, US, ES, JP |
US |
Request
To remove a unit, you make a DELETE
request to the /v2/units
resource.
Request path and header example
DELETE /v2/units/{unitId}
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Path |
Identifies the unit to delete. |
String |
Yes |
|
Header |
Access token for the customer. |
String |
Yes |
Request body example
The request has no body.
Request body properties
The request has no body.
Response
A successful response returns HTTP 204 No Content
.
On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message.
Response body example
The response has no body.
Response body properties
The response has no body.
HTTP status codes
Status | Description |
---|---|
|
Unit deleted successfully. |
|
Indicates that one or more properties in the request body aren't valid.
|
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested unit not found. |
|
Permitted rate limit, specified as the number of requests per unit of time, exceeded. You can retry the request by using exponential back-off. |
|
Error occurred on the server. You can retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Get unit
Get the details of the specified unit.
This operation is available in the following countries.
Healthcare | Hospitality | Senior Living | Core |
---|---|---|---|
US |
US, DE, IT, ES, JP |
CA, DE, FR, IT, UK, US, ES, JP |
US |
Request
To get the unit, you make a GET
request to the /v2/units
resource.
Request path and header example
GET /v2/units/{unitId}
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Path |
Identifies the unit. |
String |
Yes |
|
Header |
Access token for the customer. |
String |
Yes |
Request body example
The request has no body.
Request body properties
The request has no body.
Response
A successful response returns HTTP 200 OK
, along with the unit details.
On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message.
Response body examples
{
"id": "amzn1.alexa.unit.did.1",
"name": {
"type": "PLAIN",
"value": {
"text": "Room-100"
}
},
"level": 0,
"parentId": null
}
Response body properties
Property | Description | Type |
---|---|---|
|
Identifies the specified unit. |
String |
|
Name of the unit. |
|
|
Number of levels from the root unit. |
Integer |
|
Identifies the unit under the specified unit lives. |
String |
HTTP status codes
Status | Description |
---|---|
|
Response body contains details about the specified unit. |
|
Indicates that one or more properties in the request body aren't valid. |
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as the number of requests per unit of time, exceeded. You can retry the request by using exponential back-off. |
|
Error occurred on the server. You can retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
List units
Get a list of units under the specified parent unit. If there are no child units, the operation returns an empty list. The operation only returns units that are accessible to the caller.
This operation is available in the following countries.
Healthcare | Hospitality | Senior Living | Core |
---|---|---|---|
US |
US, DE, IT, ES, JP |
CA, DE, FR, IT, UK, US, ES, JP |
US |
Request
To list units, you make a GET
request to the /v2/units
resource.
Request path and header example
GET/v2/units?parentId={parentId}&queryDepth={queryDepth}&expand={expand}&maxResults={maxResults}&nextToken={nextToken} HTTP/1.1
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Path |
Identifies the unit under which to list the child units. |
String |
Yes |
|
Query |
Controls the number of levels of child units to retrieve.
|
String |
No |
|
Query |
Get expanded information about each unit. |
String |
No |
|
Query |
Maximum number of results to return in the response. |
Integer |
No |
|
Query |
Token from the previous response. |
String |
No |
|
Header |
Access token for the customer. |
String |
Yes |
Request body example
The request has no body.
Request body properties
The request has no body.
Response
A successful response returns HTTP 200 OK
, along with a list of units under the specified parent unit.
On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message.
Response body example
The following example shows the response that includes the parentId=amzn1.alexa.unit.2&expand=all
query parameters to get the details of the units one level under the parent unit.
The following example shows the response that includes the parentId=amzn1.alexa.unit.1
query parameter to get the units one level under the parent unit. Because the request doesn't include expand=all
, the level
, name
, and parentId
properties are null
.
The following example shows a request that uses the queryDepth=all
parameter to include all units for a parent unit, but no details. Because the request doesn't include expand=all
, the level
, name
, and parentId
properties all return null
.
Response body properties
When the request doesn't include expand=all
, the response includes the level
, name
, and parentId
properties set to null
for each unit.
Property | Description | Type |
---|---|---|
|
List of units under the specified parent ID. |
Array of objects |
|
Identifies the unit. |
String |
|
Name of the unit. |
|
|
Identifies the parent unit. |
String |
|
Number of levels from the root unit. |
Integer |
|
(Optional) Indicates whether there are more results to return. |
Object |
|
Included when the response is truncated. Use this value in a subsequent request. |
String |
HTTP status codes
Status | Description |
---|---|
|
Response body contains a list of units under the specified parent unit. |
|
Indicates that one or more properties in the request body aren't valid. |
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as the number of requests per unit of time, exceeded. You can retry the request by using exponential back-off. |
|
Error occurred on the server. You can retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Update unit
Update the name of the unit.
This operation is available in the following countries.
Healthcare | Hospitality | Senior Living | Core |
---|---|---|---|
US |
US, DE, IT, ES, JP |
CA, DE, FR, IT, UK, US, ES, JP |
US |
Request
To update a unit, you make a PUT
request to the /v2/units
resource.
Request path and header example
PUT /v2/units/{unitId} HTTP/1.1
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Path |
Identifies the unit to update. |
String |
Yes |
|
Header |
Access token for the customer. |
String |
Yes |
Request body example
{
"name": {
"type": "PLAIN",
"value": {
"text": "Room 101A"
}
}
}
Request body properties
Property | Description | Type | Required |
---|---|---|---|
|
Name of the unit. |
|
Yes |
Response
A successful response returns HTTP 204 No Content
. On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message.
Response body example
The response has no body.
Response body properties
The response has no body.
HTTP status codes
Status | Description |
---|---|
|
Unit updated successfully. |
|
Indicates that one or more properties in the request body aren't valid. |
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as the number of requests per unit of time, exceeded. You can retry the request by using exponential back-off. |
|
Error occurred on the server. You can retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Object definitions
The Property Hierarchy Management API defines the following objects.
NameValue object
The NameValue
object is a container for names of objects.
The following table defines the properties of the object.
Property | Description | Type |
---|---|---|
|
Format of the value field. At this time, the only supported type is plain text. |
String |
|
Name. |
Object |
|
Name given in plain text. |
String |
Related topics
Last updated: Sep 25, 2024