RESTCONF URI,用于访问具有多个列表元素的容器中的特定列表元素

时间:2018-04-07 17:41:37

标签: python python-requests postman

我需要在具有多个列表元素的有效负载上为GET操作创建RESTCONF URI。如:

  "System": {
    "tm-items": {
      "adminSt": "enabled",
      "sensor-items": {
        "SensorGroup-list": [
          {
            "id": "10",
            "path-items": {
              "SensorPath-list": [
                {
                  "depth": "1",
                  "filterCondition": "",
                  "path": "sys/fm/bgp",
                  "queryCondition": ""
                }
              ]
            }
          },
          {
            "id": "20",
            "path-items": {
              "SensorPath-list": [
                {
                  "depth": "5",
                  "filterCondition": "",
                  "path": "sys/fm/bgp",
                  "queryCondition": ""
                }
              ]
            }
          },
          {
            "id": "30",
            "path-items": {
              "SensorPath-list": [
                {
                  "depth": "8",
                  "filterCondition": "",
                  "path": "sys/fm/bgp",
                  "queryCondition": ""
                }
              ]
            }
          }
        ]
      },

在这里,我们注意到,SensorPath-list是一个包含3个dict元素的列表。在POSTMAN上,使用URI = {} / restconf / data / {}:System / tm-items / sensor-items,我们获取SensorPath-list下的所有3个元素。但是当尝试访问SensorPath列表时,只会在列表中找到第一个元素。 URI = {} / restconf / data / {}:System / tm-items / sensor-items / SensorPath-list

{
  "SensorGroup-list": [
    {
      "id": "10",
      "dataSrc": "DEFAULT",
      "path-items": {
        "SensorPath-list": [
          {
            "path": "sys/fm/bgp",
            "depth": "1"
          }
        ]
      }
    }
  ]
}

有没有办法访问列表中的其余元素?我们如何为它构建URI?

0 个答案:

没有答案