{"_id":"59d7d70047ed910010ada1a9","project":"568bdc1483d2061900d86cdc","version":{"_id":"59a72290d61777001b6c42c3","project":"568bdc1483d2061900d86cdc","__v":19,"createdAt":"2017-08-30T20:39:44.453Z","releaseDate":"2017-08-30T20:39:44.453Z","categories":["59a7236e3fe4d90025117c10","59a72eb6cb0db3001b84cfe2","59a734eb757d030019b85af8","59c0243b1b2d07001a9d2b76","59c035e42126e10028effb12","59c06c40df5b3c0010584a13","59c1a5852cabe5002641a3e7","59c2fb00b2b45c0010b7a3d7","59c32ceb9aea850010ac4130","59c32e6e190c90003cb0d12f","59c33affb2b45c0010b7aa23","59c7dfa457bd8200105444dc","59c7e975c50cf30010d712a0","59cffdef0cd4dd0010294d54","59d0622ca91a810032c8f60c","59d06733c1aec60026253065","59d174d44ac471001a07b123","59d5a5e323e6e800103defb2","59ecf1d8ed507c001c52b255"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.0.0","version":"0"},"category":{"_id":"59d5a5e323e6e800103defb2","project":"568bdc1483d2061900d86cdc","version":"59a72290d61777001b6c42c3","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-10-05T03:24:19.328Z","from_sync":false,"order":3,"slug":"data-modeling-with-service-classes","title":"Data Modeling With Service Classes"},"user":"58cc41f21751ce2f003be3b7","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-10-06T19:18:24.881Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"# Overview\n\nService selectors allow users to select any specific service member, or group of service members, with a single string. Service selectors cannot select multiple service members across multiple devices at the same time. Their selection is always limited to one defice at a time.\n\nSelector paths can contain the following pieces.\n\n- Service name\n- Service member name\n- Service index\n- Service ID or alias\n\nIndexed selectors use service indexes to target specific instances of a service implemented on a device. They are used when a device implements more than one service, and can be used to target one or multiple services at once. Quotation marks should not be used around index names.\n\nService indexes should have the following format.\n\n- 1-20 characters long\n- Either string or number type\n- No spaces\n- Valid characters\n - “A-Z”\n - “a-z”\n - “0-9”\n - “-” (hyphen)\n - “_” (underscore)\n\nCompound index selectors are used to target more than one service at a time. These indexes can set a device property or call a device method over multiple devices. They cannot be used to read a device property value.\n\n# Types of Selectors\n\nThere are many possible ways to construct a service selector, depending on the number of service members being targeted. Each of these service selector variants can be used in the Droplit consoles or the REST API.\n\n## Basic Selector\n\nA basic selector path specifies the service name and member name, as `SERVICE-NAME.MEMBER-NAME`.\n\n## General Index Selector\n\nAn indexed selector path, regardless of how many services the selector targets, has the general form of `SERVICE-NAME[SERVICE-INDEX].MEMBER-NAME`.\n\n## Index Number Range Selector\n\nA range of indexes can be selected using numbers separated by two periods: `..`. For example, `[5-8]` selects indexes 5, 6, 7, and 8.\n\n## Index List Selector\n\nA non-consecutive set of indexes can be selected with values separated by commas: `,`. For example: `[r1,r2]` selects r1, and r2.\n\n## Index String Range Selector\n\nA consecutive set of string indexes can be selected by separating the numeric range of those indexes by two periods: `..`.\n\nSelecting a consecutive set of string indexes can be done where the index names are numerically differentiated by separating the numeric range of the identifier with `..`. For example: `[r1..3]` selects r1, r2, and r3.\n\nTrailing characters are supported on both ends of an index. Letters preceding the range and following the range will be repeated automatically. For example, `[some1..3thing]` selects some1thing, some2thing, and some3thing.\n\nNumbers that are not part of the range will be repeated. For example: `[a1..3b4c]` selects a1b4c, a2b4c, and a3b4c.\n\nOnly one range can exist per index. For example: `[a1..3b4..5]` is not allowed.\n\n## Index String Range List Selector\n\nRanges and lists can be combined in the index by using a comma: `,`. For example: `[r1..3,r5]` selects r1, r2, r3, and r5.\n\n## Index Negation Selector\n\nIndexes can be negated from a range selection using an exclamation mark prefix. Negation always overrides inclusion. For example: `[r1..5,!r4]` selects r1, r2, r3, and r5.\n\n## Index Range Negation Selector\n\nIndex ranges can be negated from a range selection. Negation always overrides inclusion. For example: `[r1..7,!r3..5]` Includes r1 through r7, then excludes r3 through r5. In total, this selects r1, r2, r6, and r7.","excerpt":"","slug":"service-selectors","type":"basic","title":"Service Selectors"}
# Overview Service selectors allow users to select any specific service member, or group of service members, with a single string. Service selectors cannot select multiple service members across multiple devices at the same time. Their selection is always limited to one defice at a time. Selector paths can contain the following pieces. - Service name - Service member name - Service index - Service ID or alias Indexed selectors use service indexes to target specific instances of a service implemented on a device. They are used when a device implements more than one service, and can be used to target one or multiple services at once. Quotation marks should not be used around index names. Service indexes should have the following format. - 1-20 characters long - Either string or number type - No spaces - Valid characters - “A-Z” - “a-z” - “0-9” - “-” (hyphen) - “_” (underscore) Compound index selectors are used to target more than one service at a time. These indexes can set a device property or call a device method over multiple devices. They cannot be used to read a device property value. # Types of Selectors There are many possible ways to construct a service selector, depending on the number of service members being targeted. Each of these service selector variants can be used in the Droplit consoles or the REST API. ## Basic Selector A basic selector path specifies the service name and member name, as `SERVICE-NAME.MEMBER-NAME`. ## General Index Selector An indexed selector path, regardless of how many services the selector targets, has the general form of `SERVICE-NAME[SERVICE-INDEX].MEMBER-NAME`. ## Index Number Range Selector A range of indexes can be selected using numbers separated by two periods: `..`. For example, `[5-8]` selects indexes 5, 6, 7, and 8. ## Index List Selector A non-consecutive set of indexes can be selected with values separated by commas: `,`. For example: `[r1,r2]` selects r1, and r2. ## Index String Range Selector A consecutive set of string indexes can be selected by separating the numeric range of those indexes by two periods: `..`. Selecting a consecutive set of string indexes can be done where the index names are numerically differentiated by separating the numeric range of the identifier with `..`. For example: `[r1..3]` selects r1, r2, and r3. Trailing characters are supported on both ends of an index. Letters preceding the range and following the range will be repeated automatically. For example, `[some1..3thing]` selects some1thing, some2thing, and some3thing. Numbers that are not part of the range will be repeated. For example: `[a1..3b4c]` selects a1b4c, a2b4c, and a3b4c. Only one range can exist per index. For example: `[a1..3b4..5]` is not allowed. ## Index String Range List Selector Ranges and lists can be combined in the index by using a comma: `,`. For example: `[r1..3,r5]` selects r1, r2, r3, and r5. ## Index Negation Selector Indexes can be negated from a range selection using an exclamation mark prefix. Negation always overrides inclusion. For example: `[r1..5,!r4]` selects r1, r2, r3, and r5. ## Index Range Negation Selector Index ranges can be negated from a range selection. Negation always overrides inclusion. For example: `[r1..7,!r3..5]` Includes r1 through r7, then excludes r3 through r5. In total, this selects r1, r2, r6, and r7.