{"_id":"59e70b9ee027ae002e7d2ee9","category":{"_id":"59e70b9ee027ae002e7d2ed6","version":"59e70b9ee027ae002e7d2ed2","project":"5496d393f52a630b00519cdd","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-12-21T18:05:46.941Z","from_sync":false,"order":3,"slug":"rest-api","title":"REST API"},"user":"5496d353f52a630b00519cdc","parentDoc":null,"project":"5496d393f52a630b00519cdd","version":{"_id":"59e70b9ee027ae002e7d2ed2","project":"5496d393f52a630b00519cdd","__v":2,"createdAt":"2017-10-18T08:06:54.462Z","releaseDate":"2017-10-18T08:06:54.462Z","categories":["59e70b9ee027ae002e7d2ed3","59e70b9ee027ae002e7d2ed4","59e70b9ee027ae002e7d2ed5","59e70b9ee027ae002e7d2ed6","59e70b9ee027ae002e7d2ed7","59e70b9ee027ae002e7d2ed8","59e70b9ee027ae002e7d2ed9","59e70b9ee027ae002e7d2eda","59e70b9ee027ae002e7d2edb","59e70b9ee027ae002e7d2edc","59e70b9ee027ae002e7d2edd","59e70b9ee027ae002e7d2ede","59e70b9ee027ae002e7d2edf","5b8661ccdd19310003a3fa0b"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.10","version":"2.0.10"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-12-21T18:28:41.066Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"Queries for user insights, places and any other data deduced by Placer can be accessed using user_id or device_id:\n\n  * **The user_id** is an identifier that can be set through the Placer mobile SDK by your application. It is used in order to link a specific application user with a device instance on the Placer server. This allows querying the placer server API with the id set by the application. The user_id doesn’t have to be unique per app instance. For example, if a user has multiple devices with your app, the same user_id can be shared between the apps instances. \n  * **The device_id** is a unique identifier automatically assigned to the device by the Placer server. It cannot be modified. The ‘device_id’ can be obtained by calling the users or device details API with the ‘user_id’ passed as identifier.\n\nThe data provided by Placer is always related to a specific app instance, i.e. device_id. \n\nSince multiple app instances can have the same user_id, all queries based on it will return a list of device_ids that are associated with that specific user_id. In that scenario, each device_id will have it’s own Placer data (insights, places, etc).\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example\"\n}\n[/block]\nThe following example demonstrates the response structure of insights using user_id and device_id:\n\n##Using user_id\n\n*Response for BASE_URL/2/apps/APP_KEY/users/**userId_1**/insights* \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"result\\\": \\\"SUCCESS\\\",\\n  \\\"total_count\\\": 3,\\n  \\\"data\\\": [\\n    {\\n      \\\"device_id\\\": \\\"deviceId_1\\\",\\n      \\\"insights\\\": {...}\\n    },\\n    {\\n      \\\"device_id\\\": \\\"deviceId_2\\\",\\n      \\\"insights\\\": {...}\\n    },\\n    {\\n      \\\"device_id\\\": \\\"deviceId_3\\\",\\n      \\\"insights\\\": {...}\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n##Using device_id\n\n*Response for BASE_URL/2/apps/APP_KEY/devices/**deviceId_1**/insights* \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"result\\\": \\\"SUCCESS\\\",\\n  \\\"total_count\\\": 1,\\n  \\\"data\\\":[{\\n      \\\"device_id\\\": \\\"deviceId_1\\\",\\n      \\\"insights\\\": {...}\\n    }]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"user_id--device_id","type":"basic","title":"User_ID & Device_ID"}

User_ID & Device_ID


Queries for user insights, places and any other data deduced by Placer can be accessed using user_id or device_id: * **The user_id** is an identifier that can be set through the Placer mobile SDK by your application. It is used in order to link a specific application user with a device instance on the Placer server. This allows querying the placer server API with the id set by the application. The user_id doesn’t have to be unique per app instance. For example, if a user has multiple devices with your app, the same user_id can be shared between the apps instances. * **The device_id** is a unique identifier automatically assigned to the device by the Placer server. It cannot be modified. The ‘device_id’ can be obtained by calling the users or device details API with the ‘user_id’ passed as identifier. The data provided by Placer is always related to a specific app instance, i.e. device_id. Since multiple app instances can have the same user_id, all queries based on it will return a list of device_ids that are associated with that specific user_id. In that scenario, each device_id will have it’s own Placer data (insights, places, etc). [block:api-header] { "type": "basic", "title": "Example" } [/block] The following example demonstrates the response structure of insights using user_id and device_id: ##Using user_id *Response for BASE_URL/2/apps/APP_KEY/users/**userId_1**/insights* [block:code] { "codes": [ { "code": "{\n \"result\": \"SUCCESS\",\n \"total_count\": 3,\n \"data\": [\n {\n \"device_id\": \"deviceId_1\",\n \"insights\": {...}\n },\n {\n \"device_id\": \"deviceId_2\",\n \"insights\": {...}\n },\n {\n \"device_id\": \"deviceId_3\",\n \"insights\": {...}\n }\n ]\n}", "language": "json" } ] } [/block] ##Using device_id *Response for BASE_URL/2/apps/APP_KEY/devices/**deviceId_1**/insights* [block:code] { "codes": [ { "code": "{\n \"result\": \"SUCCESS\",\n \"total_count\": 1,\n \"data\":[{\n \"device_id\": \"deviceId_1\",\n \"insights\": {...}\n }]\n}", "language": "json" } ] } [/block]