{"_id":"551ca655b7a32b3b00d1ef6a","parentDoc":null,"category":{"_id":"551ca3927405910d00900a59","pages":["551ca655b7a32b3b00d1ef6a","551cb8f35de8de3900d8db0d","551cb97f5de8de3900d8db0f","55293316a15e530d00af3cb3","55882c89eb5f2421003f9a1c","55883030eb5f2421003f9a2f"],"project":"5435693035740020002a1c1c","version":"5435693035740020002a1c1f","__v":6,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-02T02:04:02.634Z","from_sync":false,"order":2,"slug":"api-resources","title":"API Resources"},"githubsync":"","version":{"_id":"5435693035740020002a1c1f","__v":15,"project":"5435693035740020002a1c1c","createdAt":"2014-10-08T16:41:20.702Z","releaseDate":"2014-10-08T16:41:20.702Z","categories":["5435693035740020002a1c20","551c03c1ff892b3700d1c57a","551ca3927405910d00900a59","551cac6448564a2f0024d89e","551cb4d848564a2f0024d8a3","551cb52db7a32b3b00d1ef78","5526e2064a7ac121004c6073","5526e5147d4a4417009516b3","5526e9877d4a4417009516bb","5528362cd9e1db2d00cd924d","5580240ebe698419008f2ba2","5580a7dabe698419008f2db6","568161799de23c0d00c54750","5866c905a2cbb31900f6f1aa","5bfc066d8342500013783e0c"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"543569cd35740020002a1c2d","project":"5435693035740020002a1c1c","__v":11,"updates":["58ffa9eaa562150f00b9fdaa"],"next":{"pages":[],"description":""},"createdAt":"2015-04-02T02:15:49.808Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"A presence object may be associated with a user resource directly, or with a device. If presence is associated to a device, that typically indicates that a person is sensed but cannot be identified. This is common when detecting presence using devices such as IR sensors.\n\nUpon creation, the `arrived_at` attribute is initialized to the current time and the `expired_at` value is set to the TTL (time to live) added to the current time.\n\nEach time presence is posted for a [user](doc:user) or device that already has an active presence session (a session in the same space that hasn't expired) than the active session will be lengthened by the provided TTL. Otherwise a new presence session is created.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"The maximum allowed TTL is 20 minutes, however for the best results we recommend using a value less than 5 minutes. In the future we may reduce the maximum allowed TTL.\",\n  \"title\": \"Keep your presence TTL short\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Properties\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"`location_id`\",\n    \"0-2\": \"The ID of the location where the presence was detected.\",\n    \"0-1\": \"Integer\",\n    \"h-0\": \"Property\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"1-2\": \"The ID of the space where the presence was detected or null if the presence exists at the location (not space) level.\",\n    \"1-1\": \"Integer\",\n    \"1-0\": \"`space_id`\",\n    \"2-2\": \"The ID of the user, or null if the presence is associated only to a device.\",\n    \"2-0\": \"`user_id`\",\n    \"2-1\": \"Integer\",\n    \"3-2\": \"The ID of the device, or null if the presence is associated only to a user.\",\n    \"3-0\": \"`device_id`\",\n    \"3-1\": \"Integer\",\n    \"4-0\": \"`last_seen_at`\",\n    \"4-2\": \"The date and time when the presence was last seen, represented as an ISO-8601 date.\",\n    \"4-1\": \"String\",\n    \"5-0\": \"`arrived_at`\",\n    \"5-1\": \"String\",\n    \"5-2\": \"The date and time when the presence was first detected, represented as an ISO-8601 date.\",\n    \"6-0\": \"`expired_at`\",\n    \"6-1\": \"String\",\n    \"6-2\": \"The date and time when the presence will expire, represented as an ISO-8601 date. (This should always be equal to the TTL added to the last_seen_at attribute)\",\n    \"7-0\": \"`session_active`\",\n    \"7-2\": \"Indicates whether the session is currently active.\",\n    \"7-1\": \"Boolean\",\n    \"8-0\": \"`user`\",\n    \"8-1\": \"Object\",\n    \"8-2\": \"The [user](doc:user)  resource, if the presence is associated to a user.\",\n    \"9-0\": \"`device`\",\n    \"9-1\": \"Object\",\n    \"9-2\": \"The [Device](doc:device)  resource, if the presence is associated to a device.\"\n  },\n  \"cols\": 3,\n  \"rows\": 10\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"location_id\\\": 1,\\n  \\\"space_id\\\": 1,\\n  \\\"user_id\\\": 4,\\n  \\\"device_id\\\": 2,\\n  \\\"last_seen_at\\\": \\\"2014-05-22T14:49:48+0000\\\",\\n  \\\"arrived_at\\\": \\\"2014-05-22T14:49:48+0000\\\",\\n  \\\"expired_at\\\": \\\"2014-05-22T14:50:18+0000\\\",\\n  \\\"session_ttl\\\": 30,\\n  \\\"session_active\\\": true,\\n  \\\"user\\\": {\\n    \\\"id\\\": 1,\\n    \\\"name\\\": \\\"Brian\\\",\\n    \\\"slug\\\": \\\"brian\\\",\\n    \\\"avatar\\\": \\\"\\\",\\n    \\\"created_at\\\": \\\"2014-05-05T16:06:58+0000\\\",\\n    \\\"updated_at\\\": \\\"2014-05-05T16:06:58+0000\\\",\\n    \\\"primary_email\\\": {\\n      \\\"email\\\": \\\"brian:::at:::robinpowered.com\\\",\\n      \\\"is_verified\\\": false\\n    }\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": null\n    }\n  ]\n}\n[/block]","excerpt":"A time period (session) that a user was detected in a space or location.","slug":"presence","type":"basic","title":"Presence"}

Presence

A time period (session) that a user was detected in a space or location.

A presence object may be associated with a user resource directly, or with a device. If presence is associated to a device, that typically indicates that a person is sensed but cannot be identified. This is common when detecting presence using devices such as IR sensors. Upon creation, the `arrived_at` attribute is initialized to the current time and the `expired_at` value is set to the TTL (time to live) added to the current time. Each time presence is posted for a [user](doc:user) or device that already has an active presence session (a session in the same space that hasn't expired) than the active session will be lengthened by the provided TTL. Otherwise a new presence session is created. [block:callout] { "type": "info", "body": "The maximum allowed TTL is 20 minutes, however for the best results we recommend using a value less than 5 minutes. In the future we may reduce the maximum allowed TTL.", "title": "Keep your presence TTL short" } [/block] [block:api-header] { "type": "basic", "title": "Properties" } [/block] [block:parameters] { "data": { "0-0": "`location_id`", "0-2": "The ID of the location where the presence was detected.", "0-1": "Integer", "h-0": "Property", "h-1": "Type", "h-2": "Description", "1-2": "The ID of the space where the presence was detected or null if the presence exists at the location (not space) level.", "1-1": "Integer", "1-0": "`space_id`", "2-2": "The ID of the user, or null if the presence is associated only to a device.", "2-0": "`user_id`", "2-1": "Integer", "3-2": "The ID of the device, or null if the presence is associated only to a user.", "3-0": "`device_id`", "3-1": "Integer", "4-0": "`last_seen_at`", "4-2": "The date and time when the presence was last seen, represented as an ISO-8601 date.", "4-1": "String", "5-0": "`arrived_at`", "5-1": "String", "5-2": "The date and time when the presence was first detected, represented as an ISO-8601 date.", "6-0": "`expired_at`", "6-1": "String", "6-2": "The date and time when the presence will expire, represented as an ISO-8601 date. (This should always be equal to the TTL added to the last_seen_at attribute)", "7-0": "`session_active`", "7-2": "Indicates whether the session is currently active.", "7-1": "Boolean", "8-0": "`user`", "8-1": "Object", "8-2": "The [user](doc:user) resource, if the presence is associated to a user.", "9-0": "`device`", "9-1": "Object", "9-2": "The [Device](doc:device) resource, if the presence is associated to a device." }, "cols": 3, "rows": 10 } [/block] [block:api-header] { "type": "basic", "title": "Example" } [/block] [block:code] { "codes": [ { "code": "{\n \"location_id\": 1,\n \"space_id\": 1,\n \"user_id\": 4,\n \"device_id\": 2,\n \"last_seen_at\": \"2014-05-22T14:49:48+0000\",\n \"arrived_at\": \"2014-05-22T14:49:48+0000\",\n \"expired_at\": \"2014-05-22T14:50:18+0000\",\n \"session_ttl\": 30,\n \"session_active\": true,\n \"user\": {\n \"id\": 1,\n \"name\": \"Brian\",\n \"slug\": \"brian\",\n \"avatar\": \"\",\n \"created_at\": \"2014-05-05T16:06:58+0000\",\n \"updated_at\": \"2014-05-05T16:06:58+0000\",\n \"primary_email\": {\n \"email\": \"brian@robinpowered.com\",\n \"is_verified\": false\n }\n }\n}", "language": "json", "name": null } ] } [/block]