Selector parameter

Theselectorparameter of the GET method filters the returned data to include only those attributes that belong to the specified category. By using theselector参数,你一个void having to list attributes individually using theattributesparameter.

The default is to include all categories. Use a comma (,) to separate multiple category values.

The selector categories are the following:

配置

Contains user-owned information. Attributes in the configuration category can be supplied by users through REST requests or through the switch CLI. Although an attribute must be in the configuration category to be modified by a user, not all attributes in the configuration category can be modified after the resource instance is created.

writable

Contains the mutable (writable) configuration attributes.

statistics

Contains system-supplied data such as counters. Attributes in thestatisticscategory cannot be written by users.

status

Contains system-owned data such as the admin account and various status fields. Attributes in thestatuscategory cannot be written by users.

For example, to get the configuration attributes of all VLANs, when you specify the URI of the GET method, do the following:
  • 指定depth=2to direct the REST API return the JSON representations of each VLAN instead of the URI of each VLAN in the list. If you do not specifydepth=2, the REST API returns each VLAN represented as a URI, which does not include the attributes of the individual VLANs.

  • 指定selectorparameter with the value配置.

GET "https://192.0.2.5/rest/v10.04/system/vlans?depth=2&selector=configuration"

Example response:

{ { "admin": "up", "id": 1, "mgmd_enable": {}, "mgmd_igmp_block_ports": [], "mgmd_igmp_fastleave_ports": [], "mgmd_igmp_forcedfastleave_ports": [], "mgmd_igmp_forward_ports": [], "mgmd_igmp_static_groups": [], "mgmd_mld_block_ports": [], "mgmd_mld_fastleave_ports": [], "mgmd_mld_forcedfastleave_ports": [], "mgmd_mld_forward_ports": [], "mgmd_mld_static_groups": [], "name": "VLAN1", "type": "static" }, { "admin": "up", "id": 10, "mgmd_enable": {}, "mgmd_igmp_block_ports": [], "mgmd_igmp_fastleave_ports": [], "mgmd_igmp_forcedfastleave_ports": [], "mgmd_igmp_forward_ports": [], "mgmd_igmp_static_groups": [], "mgmd_mld_block_ports": [], "mgmd_mld_fastleave_ports": [], "mgmd_mld_forcedfastleave_ports": [], "mgmd_mld_forward_ports": [], "mgmd_mld_static_groups": [], "name": "VLAN10", "type": "static" }, { "admin": "up", "id": 20, "mgmd_enable": {}, "mgmd_igmp_block_ports": [], "mgmd_igmp_fastleave_ports": [], "mgmd_igmp_forcedfastleave_ports": [], "mgmd_igmp_forward_ports": [], "mgmd_igmp_static_groups": [], "mgmd_mld_block_ports": [], "mgmd_mld_fastleave_ports": [], "mgmd_mld_forcedfastleave_ports": [], "mgmd_mld_forward_ports": [], "mgmd_mld_static_groups": [], "name": "VLAN20", "type": "static" } }