{"_id":"582789abbe5c080f00a5a818","project":"568bdc1483d2061900d86cdc","__v":0,"category":{"_id":"587c422af45e2d0f005e200d","__v":0,"version":"582789aabe5c080f00a5a7fe","project":"568bdc1483d2061900d86cdc","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-16T03:46:50.263Z","from_sync":false,"order":2,"slug":"device-modeling","title":"Device Modeling"},"parentDoc":null,"user":"568bdbc4fe6fcc0d006dc970","version":{"_id":"582789aabe5c080f00a5a7fe","__v":10,"project":"568bdc1483d2061900d86cdc","createdAt":"2016-11-12T21:29:14.915Z","releaseDate":"2016-11-12T21:29:14.915Z","categories":["582789abbe5c080f00a5a7ff","582789abbe5c080f00a5a800","582789abbe5c080f00a5a801","582789abbe5c080f00a5a802","582789abbe5c080f00a5a803","582789abbe5c080f00a5a804","582789abbe5c080f00a5a805","582789abbe5c080f00a5a806","582789abbe5c080f00a5a807","582789abbe5c080f00a5a808","5827ea984ca29e0f00137a9e","583df597887db62f00644283","583df5d9c622791900e78da5","5845cd8763c11b250037967d","5845d13063c11b2500379681","5859e859e3306d1900126725","587aeb9a01cf3a0f008359eb","587c422af45e2d0f005e200d","587d84dc82f6f30f004ceee5"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"beta2","version_clean":"0.0.0","version":"0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-20T07:31:14.935Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"# Selector paths\n\n## Introduction\nSelector paths allow you to select any specific service member of a device with a single string.\n\nSelectors will always resolve to a specific service member of a specific service of a device.\n\n## Components\nSelector paths can contain:\n - service name\n - member name\n - index\n - id or alias\n \n## Basic Selector\nThe basic selector path specifies the service name and member name.\n\nExample: `serviceName.memberName`\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"droplit device get D573c161f80c1a10c2104efb6 serviceName.memberName\",\n      \"language\": \"text\",\n      \"name\": \"console\"\n    }\n  ]\n}\n[/block]\n## Indexed Selector\nAn indexed selector has a service index specified. This is used when a device has more than once instance of a service. Indexes can be an integer or a string.\nIndex selectors can be 1 to 20 characters long, and be either a string or a number type.\nSelectors are constrained to a subset of valid Url characters: `[0-9a-zA-Z\\-_]`\nDo not use quotes around index name.\n\nExample: `serviceName[index].memberName`\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"droplit device get D573c161f80c1a10c2104efb6 serviceName[index].memberName\",\n      \"language\": \"text\",\n      \"name\": \"console\"\n    }\n  ]\n}\n[/block]\n## Compound Index Selector\nService indexes can address more than one service instances if the selector string is being used to set a device property or call a device method.\nCompound index selectors cannot be used to read a property value.\n\n### Index Number Range\nSelecting a range of indexes can be done with numbers separated by `..`.\n\nExample: `[5..8]` - selects `5`, `6`, `7`, and `8`\n\n### Index List\nSelecting a non-consecutive set of indexes can be done with values separated by commas (`,`).\n\nExample: `[r1,r2]` - selects `r1`, and `r2`\nNote: Spaces are not allowed\n\n### Index String Range\nSelecting a consecutive set of string typed indexes can be done where the index names are numerically differentiated by separating the numeric range of the identifier with `..`.\n\nExample: `[r1..3]` - selects `r1`, `r2`, and `r3`\n\nTrailing characters are supported just as you might expect.\n\nExample: `[some1..3thing]` - selects `some1thing`, `some2thing`, and `some3thing`\n\nLetters preceding the range and following the range will be repeated automatically.\n\nNumbers that are not part of the range will be repeated.\n\nExample: `[a1..3b4c]` - selects `a1b4c`, `a2b4c`, and `a3b4c`\n\n > NOTE: Only one range can exist per identifier. For example, `[a1..3b4..5]` is not allowed.\n\n### Index String Range List\nRanges and lists can be combined in the index.\n\nExample: `[r1..3,r5]` - selects `r1`, `r2`, `r3`, and `r5`\n\n### Index Negation\nIndexes can be negated from a range selection using an exclamation mark prefix. Negation always overrides inclusion.\n\nExample: `[r1..5,!r4]` - selects `r1`, `r2`, `r3`, and `r5`\n\n### Index Range Negation\nIndex ranges can be negated from a range selection. Negation always overrides inclusion.\n\nExample: `[r1..7,!r3..5]` - Includes `r1` through `r7`, then excludes `r3` through `r5` selecting `r1`, `r2`, `r6`, and `r7`","excerpt":"Selecting custom sets of service properties","slug":"service-selectors","type":"basic","title":"Service Selectors"}

Service Selectors

Selecting custom sets of service properties

# Selector paths ## Introduction Selector paths allow you to select any specific service member of a device with a single string. Selectors will always resolve to a specific service member of a specific service of a device. ## Components Selector paths can contain: - service name - member name - index - id or alias ## Basic Selector The basic selector path specifies the service name and member name. Example: `serviceName.memberName` [block:code] { "codes": [ { "code": "droplit device get D573c161f80c1a10c2104efb6 serviceName.memberName", "language": "text", "name": "console" } ] } [/block] ## Indexed Selector An indexed selector has a service index specified. This is used when a device has more than once instance of a service. Indexes can be an integer or a string. Index selectors can be 1 to 20 characters long, and be either a string or a number type. Selectors are constrained to a subset of valid Url characters: `[0-9a-zA-Z\-_]` Do not use quotes around index name. Example: `serviceName[index].memberName` [block:code] { "codes": [ { "code": "droplit device get D573c161f80c1a10c2104efb6 serviceName[index].memberName", "language": "text", "name": "console" } ] } [/block] ## Compound Index Selector Service indexes can address more than one service instances if the selector string is being used to set a device property or call a device method. Compound index selectors cannot be used to read a property value. ### Index Number Range Selecting a range of indexes can be done with numbers separated by `..`. Example: `[5..8]` - selects `5`, `6`, `7`, and `8` ### Index List Selecting a non-consecutive set of indexes can be done with values separated by commas (`,`). Example: `[r1,r2]` - selects `r1`, and `r2` Note: Spaces are not allowed ### Index String Range Selecting a consecutive set of string typed indexes can be done where the index names are numerically differentiated by separating the numeric range of the identifier with `..`. Example: `[r1..3]` - selects `r1`, `r2`, and `r3` Trailing characters are supported just as you might expect. Example: `[some1..3thing]` - selects `some1thing`, `some2thing`, and `some3thing` Letters preceding the range and following the range will be repeated automatically. Numbers that are not part of the range will be repeated. Example: `[a1..3b4c]` - selects `a1b4c`, `a2b4c`, and `a3b4c` > NOTE: Only one range can exist per identifier. For example, `[a1..3b4..5]` is not allowed. ### Index String Range List Ranges and lists can be combined in the index. Example: `[r1..3,r5]` - selects `r1`, `r2`, `r3`, and `r5` ### Index Negation Indexes can be negated from a range selection using an exclamation mark prefix. Negation always overrides inclusion. Example: `[r1..5,!r4]` - selects `r1`, `r2`, `r3`, and `r5` ### Index Range Negation Index ranges can be negated from a range selection. Negation always overrides inclusion. Example: `[r1..7,!r3..5]` - Includes `r1` through `r7`, then excludes `r3` through `r5` selecting `r1`, `r2`, `r6`, and `r7`