Sanctuary Web API

From Valley Campus Developers Wiki
Jump to: navigation, search

Contents

REST API Resources

GET messages

Query the gathered messages issued by sensors.

Resource Information

OAuth2.0 Required? YES
Response Formats json
HTTP Methods GET
Required to wakeup NO

Parameters

URL Query Parameter
Parameter name description Example value Mandatory?
count The number of messages to query. Must be less than or equal to 2000. Defaults to 20. 10 Optional
gateway_id The gateway_id to query. 82418490-c60a-11e1-9b21-0800200c9a66 Optional
cluster_id The cluster id to query, in hexadecimal form. 0405 Optional
address The EUI64 address to query. 00137a000000649c Optional
from The period of messages to query. Wed May 01 18:00:00 JST 2013 Optional
to Wed May 15 09:30:30 JST 2013

Example Request

GET https://api.valleycampus.net/messages?count=1&cluster_id=0405

  • Response
[
  {
    "timestamp":"Wed Aug 29 11:21:25 JST 2012",
    "gateway_id":"82418490-c60a-11e1-9b21-0800200c9a66",
    "address":"00137a000000649c",
    "cluster_id":1029,
    "data":
    [
     {
      "data_type":33,
      "data":5894,
      "attribute_id":0
      }
    ],
    "message_id":"86f09d70-f1eb-11e1-bbdd-123143051a4a"
  }
]

GET gateways

Get current gateways registered with Sanctuary.

Resource Information

OAuth2.0 Required? YES
Response Formats json
HTTP Methods GET
Required to wakeup NO

Parameters

None

Example Request

GET https://api.valleycampus.net/gateways

  • Response
{
  [
    "82418490-c60a-11e1-9b21-0800200c9a66",
    "86c0a410-c60a-11e1-9b21-0800200c9a66"
  ]
}

GET gateways/{gateway_id}

Get the gateway information.

Resource Information

OAuth2.0 Required? YES
Response Formats json
HTTP Methods GET
Required to wakeup NO

Parameters

Request Parameter
Parameter name description Example value Mandatory?
gateway_id A unique ID that is assigned to the gateway. 82418490-c60a-11e1-9b21-0800200c9a66 YES

Example Request

GET https://api.valleycampus.net/gateways/82418490-c60a-11e1-9b21-0800200c9a66

  • Response
{
  "name":"My Gateway 1",
  "gateway_secret":"12ydwadaw56j5XWDJWFD4A",
  "device_address":"0013a2004064eccd",
  "remote":
   {
    "port":1792,
    "username":"eyasato",
    "host":"192.168.11.123"
   }
}

PUT gateways/{gatway_id}

Perform changes to the gateway information.

Resource Information

OAuth2.0 Required? YES
Response Formats json
HTTP Methods PUT
Required to wakeup NO

Parameters

Request Parameter
Parameter name description Example value Mandatory?
gatway_id A unique ID that is assigned to the gateway. 82418490-c60a-11e1-9b21-0800200c9a66 YES
JSON Parameter
Parameter name description Example value Mandatory?
name Gateway's name. foobar YES
remote.host IP Address. 192.168.11.100 Optional
remote.username Basic Authentication username. valleycampus Optional
remote.password Basic Authentication password. valleycampus123456 Optional

Example Request

PUT https://api.valleycampus.net/gateways/82418490-c60a-11e1-9b21-0800200c9a66

  • Request(json)
{
  "name" : "foobar",
  "remote":
  {
    "host" : "192.168.11.100",
    "username" : "valleycampus",
    "password" : "valleycampus123456"
  }
}
  • Response

None

GET gateways/{gateway_id}/nodes/{address}

Discover active services at remote device.

Resource Information

OAuth2.0 Required? YES
Response Formats json
HTTP Methods GET
Required to wakeup YES

Parameters

Request Parameter
Parameter name description Example value Mandatory?
gateway_id A unique ID that is assigned to the gateway. 82418490-c60a-11e1-9b21-0800200c9a66 YES
address EUI64 address of the desired node. 00137a00000064a6 YES
URL Query Parameter
Parameter name description Example value Mandatory?
cache To force service discover, set 'false'. false Optional

GET https://api.valleycampus.net/gateways/82418490-c60a-11e1-9b21-0800200c9a66/nodes/00137a00000064a6

  • Response
{
  "services" :
  [
    {
      "device_version" : 0,
      "profile_id" : 260,
      "in_clusters" : [0, 1, 3, 9, 2, 5],
      "device_id" : 770,
      "endpoint" : 10
    },
  "device_address" : "00137a00000064a6",
  "network_address" : "37c2"
  ]
}

POST gateways/{gateway_id}/nodes/{address}

Send a raw ZCL command and wait for the response.

Resource Information

OAuth2.0 Required? YES
Response Formats json
HTTP Methods POST
Required to wakeup YES

Parameters

Request Parameter
Parameter name description Example value Mandatory?
gateway_id A unique ID that is assigned to the gateway. 82418490-c60a-11e1-9b21-0800200c9a66 YES
address EUI64 address of the desired node. 00137c00000078cc YES
URL Query Parameter
Parameter name description Example value Mandatory?
cluster_id Specify the cluster id, in hexadecimal form. 0006 YES
endpoint Specify the destination endpoint, in hexadecimal form. 0a YES
manufacturer_code The manufacturer code, if available, in hexadecimal form. 0729 Optional
JSON Request Parameter
Parameter name description Example value Mandatory?
command_id Specify the command id. 2 YES

Example Request

POST https://api.valleycampus.net/gateways/82418490-c60a-11e1-9b21-0800200c9a66/nodes/00137c00000078cc?endpoint=0a&cluster_id=0006

  • Request(json)
{
  "command_id" : 2
}
  • Response
{
  "command_id" : 11,
  "payload" : [2, 0]
} 

GET gateways/{gateway_id}/nodes/{address}/attributes

Read attributes value or discover attributes from the node.

Resource Information

OAuth2.0 Required? YES
Response Formats json
HTTP Methods GET
Required to wakeup YES

Parameters

Request Parameter
Parameter name description Example value Mandatory?
gateway_id A unique ID that is assigned to the gateway. 82418490-c60a-11e1-9b21-0800200c9a66 YES
address EUI64 address of the desired node. 00137c000000649c YES
URL Query Parameter (Read attributes value)
Parameter name description Example value Mandatory?
mode Must be "read" read YES
endpoint Specify the destination endpoint, in hexadecimal form. 0a YES
cluster_id Specify the cluster id, in hexadecimal form. 0405 YES
attributes_id The attributes to read, in hexadecimal form. Can specify multiple attribute identifiers separated by the character ':'. 0000:00001:00002 YES
manufacturer_code The manufacturer code, if available, in hexadecimal form. 0729 Optional
URL Query Parameter (Discover attributes)
Parameter name description Example value Mandatory?
mode Must be "discover". discover YES
endpoint Specify the destination endpoint, in hexadecimal form. 0a YES
cluster_id Specify the cluster id, in hexadecimal form. 0000 YES
start_attribute_id The attribute id at which to begin the attribute discovery. 0 YES
max_attribute_id The number of attribute ids that are to be returned in the response. 10 YES
manufacturer_code The manufacturer code, if available, in hexadecimal form. 0729 Optional

Example Request

GET https://api.valleycampus.net/gateways/82418490-c60a-11e1-9b21-0800200c9a66/nodes/00137c000000649c/attributes?mode=read&endpoint=0a&cluster_id=0000&attributes_id=00000

  • Response
[
  {
    "status" : 0,
    "data_type" : 20,
    "value" : 2,
    "attribute_id" : 0
  }
]

GET https://api.valleycampus.net/gateways/82418490-c60a-11e1-9b21-0800200c9a66/nodes/00137c000000649c/attributes?mode=discover&endpoint=0a&cluster_id=0000&start_attribute_id=0000&max_attribute_id=3

  • Response
{
  "complete" : false,
  "attributes_info":
  [
    {
      "attribute_id" : 0,
      "data_type" : 20
    },
    {
      "attribute_id" : 1,
      "data_type" : 20
    },
    {
      "attribute_id" : 2,
      "data_type" : 20
    }
  ]
}

POST gateways/{gateway_id}/nodes/{address}/attributes/configuration

Configure the messages to the node.

Resource Information

OAuth2.0 Required? YES
Response Formats json
HTTP Methods POST
Required to wakeup YES

Parameters

Request Parameter
Parameter name description Example value Mandatory?
gateway_id A unique ID that is assigned to the gateway. 82418490-c60a-11e1-9b21-0800200c9a66 YES
address EUI64 address of the desired node. 00137c000000649c YES
URL Query Parameter
Parameter name description Example value Mandatory?
cluster_id Specify the cluster id, in hexadecimal form. 0405 YES
endpoint Specify the destination endpoint, in hexadecimal form. 0a YES
manufacturer_code The manufacturer code, if available, in hexadecimal form. 0729 Optional
JSON Request Parameter description
Parameter name description Example value Mandatory?
attribute_id The attribute to configure. 0 YES
data_type The data type of the attribute. 21 YES
minimum_reporting_interval The minimum interval (in seconds) between issuing reports of the specified attribute. 60 YES
maximum_reporting_interval The maximum interval (in seconds) between issuing reports of the specified attribute. 90 YES
reportable_change The minimum change to the attribute that will result in a report being issued. 200 Optional

Example Request

POST https://api.valleycampus.net/gateways/82418490-c60a-11e1-9b21-0800200c9a66/nodes/00137c000000649c/attributes/configuration?endpoint=0a&cluster_id=0402

  • Request(json)
[
  {
    "attribute_id" : 0,
    "data_type" : 41,
    "minimum_reporting_interval" : 60,
    "maximum_reporting_interval" : 90
  }
]
  • Response
{
  "status" : 0
}

GET gateways/{gateway_id}/nodes/{address}/attributes/configuration

Read the current messages configuration from the node.

Resource Information

OAuth2.0 Required? YES
Response Formats json
HTTP Methods GET
Required to wakeup YES

Parameters

Request Parameter
Parameter name description Example value Mandatory?
gateway_id A unique ID that is assigned to the gateway. 82418490-c60a-11e1-9b21-0800200c9a66 YES
address EUI64 address of the desired node. 00137c000000649c YES
URL Query Parameter
Parameter name description Example value Mandatory?
cluster_id Specify the cluster id, in hexadecimal form. 0405 YES
endpoint Specify the destination endpoint, in hexadecimal form. 0a YES
attributes_id The attributes to read configurations. Can specify multiple attribute identifiers separated by the character ':', in hexadecimal form. 0000:0001:0002 YES
manufacturer_code The manufacturer code, if available, in hexadecimal form. 1833 Optional

Example Request

GET https://api.valleycampus.net/gateways/82418490-c60a-11e1-9b21-0800200c9a66/nodes/00137c000000649c/attributes/configuration?endpoint=0a&cluster_id=0405&attributes_id=0000

  • Response
[
  {
    "status" : 0,
    "attribute_id" : 0,
    "data_type" : 33,
    "minimum_reporting_interval" : 60,
    "maximum_reporting_interval" : 90
  }
]

POST gateways/{gateway_id}/nodes/{address}/zdp

Send a raw ZDP command and wait for the response.

Resource Information

OAuth2.0 Required? YES
Response Formats json
HTTP Methods POST
Required to wakeup YES

Parameters

Request Parameter
Parameter name description Example value Mandatory?
gateway_id A unique ID that is assigned to the gateway. 82418490-c60a-11e1-9b21-0800200c9a66 YES
address EUI64 address of the desired node. 00137c000000649c YES
JSON Parameter
Parameter name description Example value Mandatory?
cluster_id Specify the cluster_id. 33 YES
payload Specify the payload. [125,137,0,0,0,122,19,0,1,0,4,3,199,182,134,64,0,162,19,0,3] YES

Example Request

POST https://api.valleycampus.net/gateways/82418490-c60a-11e1-9b21-0800200c9a66/nodes/00137c00000089ff/zdp

  • Request(json)
{
  "cluster_id":33,
  "payload":[125,137,0,0,0,122,19,0,1,0,4,3,199,182,134,64,0,162,19,0,3]
}
  • Response
{
	"cluster_id":32801,
	"payload":[0]
} 
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox