创建针对多列表元素负载的GET操作RESTCONF URI
Let's break down how to build the correct RESTCONF URI to target a specific list element in your nested structure. RESTCONF uses a hierarchical path based on your data model, with special syntax to target individual list items using their key fields.
Step-by-Step Breakdown
Start with the standard RESTCONF data root:
All data retrieval URIs begin with/restconf/data— this is the base path for accessing configuration or state data via RESTCONF.Traverse the container hierarchy:
Follow the structure of your payload from top to bottom:System(top-level container)tm-items(child container)sensor-items(child container)
Target the specific top-level list element:
Lists in RESTCONF require you to specify their key field to select an individual item. For yourSensorGroup-list, the key isid. Use the syntaxlist-name=key=valueto pin down the exact element:- To get the
SensorGroup-listitem withid="10", appendSensorGroup-list=id=10to the path.
- To get the
Drill into nested sub-lists (if needed):
If you want to target a specificSensorPath-listitem inside that group, repeat the list targeting syntax. Assumingdepthis the key field forSensorPath-list, append/path-items/SensorPath-list=depth=1to reach the item withdepth="1".
Example URIs
Get the entire
SensorGroup-listitem withid=10:/restconf/data/System/tm-items/sensor-items/SensorGroup-list=id=10Get the specific
SensorPath-listitem (depth=1) inside theid=10SensorGroup:/restconf/data/System/tm-items/sensor-items/SensorGroup-list=id=10/path-items/SensorPath-list=depth=1Get the
id=20SensorGroup's SensorPath item with depth=5:/restconf/data/System/tm-items/sensor-items/SensorGroup-list=id=20/path-items/SensorPath-list=depth=5
Key Notes
- Always use the defined key field of the list to target individual items — this is the most efficient and standard approach in RESTCONF (reserve query param filtering for cases where you need to match non-key fields).
- Container names are used as-is in the path; only lists require the
list-name=key=valuesyntax to select a specific entry.
内容的提问来源于stack exchange,提问作者Bala

