The App Cloud APIs expose the Core API endpoints, but with the addition of adding per user authentication and authorization. For example, you may choose to build with App Cloud APIs when developing for a mobile platform.
Cognitive Systems App Cloud API
Download OpenAPI description
Languages
Servers
Mock server
https://docs.cognitivesystems.com/_mock/assets/specs/api/app_cloud/
https://docs.cognitivesystems.com/api/v1/
Request
Both the owner or the member bound to the network can consume this endpoint. Responds to the application whether sleep feature is enabled, and the user-provided household sleep time and household wake time.
If the owner has not yet enabled the feature viaPOST, the following template is sent:
{
enabled: false,
sleep_hour: 23,
sleep_minute: 0,
wake_hour: 7,
wake_minute: 0
}A record of the household settings is made only when the feature is enabled for the first time.
Security
Authorization
- Mock serverhttps://docs.cognitivesystems.com/_mock/assets/specs/api/app_cloud/sleep_times/settings
- https://docs.cognitivesystems.com/api/v1/sleep_times/settings
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
https://docs.cognitivesystems.com/_mock/assets/specs/api/app_cloud/sleep_times/settings \
-H 'Authorization: YOUR_API_KEY_HERE'Response
application/json
{ "enabled": false, "sleep_hour": 23, "sleep_minute": 0, "wake_hour": 9, "wake_minute": 15 }
- Mock serverhttps://docs.cognitivesystems.com/_mock/assets/specs/api/app_cloud/sleep_times/settings
- https://docs.cognitivesystems.com/api/v1/sleep_times/settings
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
https://docs.cognitivesystems.com/_mock/assets/specs/api/app_cloud/sleep_times/settings \
-H 'Authorization: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"enabled": false,
"sleep_hour": 23,
"sleep_minute": 0,
"wake_hour": 9,
"wake_minute": 15
}'Response
application/json
{ "enabled": false, "sleep_hour": 23, "sleep_minute": 0, "wake_hour": 9, "wake_minute": 15 }
- Mock serverhttps://docs.cognitivesystems.com/_mock/assets/specs/api/app_cloud/sleep_times/data/{queried_days}
- https://docs.cognitivesystems.com/api/v1/sleep_times/data/{queried_days}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://docs.cognitivesystems.com/_mock/assets/specs/api/app_cloud/sleep_times/data/{queried_days}?force_past=false' \
-H 'Authorization: YOUR_API_KEY_HERE'Bodyapplication/json
the unarmed/home/0 or armed/away/ 1 history of the network
Example: {"data":[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"from_ts":1618243200,"bucket":3600}
the array of days queried, length of array will match queried number of days
Example: [{"house_day":18729,"sleep_ts":1618266600,"sleep_weight":0.923879533,"wake_ts":1618286400,"wake_weight":0.965925826},{"house_day":18730,"sleep_ts":1618353900,"sleep_weight":0.896872742,"wake_ts":1618372800,"wake_weight":0.965925826},{"house_day":18731,"sleep_ts":1618440300,"sleep_weight":0.896872742,"wake_ts":1618476300,"wake_weight":0.555570233},{"house_day":18732,"sleep_ts":1618517700,"sleep_weight":0.98078528,"wake_ts":1618545600,"wake_weight":0.965925826},{"house_day":18734,"sleep_ts":1618687800,"sleep_weight":0.923879533,"wake_ts":1618711200,"wake_weight":0.707106781},{"house_day":18735,"sleep_ts":1618766100,"sleep_weight":0.555570233,"wake_ts":1618807500,"wake_weight":0.997858923}]
Response
application/json
{ "avg_sleep_time_s": 82380, "avg_wake_time_s": 23280, "duration_avg_s": 27900, "queried_days": 6, "motion_state": { "data": [ … ], "from_ts": 1618243200, "bucket": 3600 }, "data": [ { … }, { … }, { … }, { … }, { … }, { … } ] }