Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-1178

POST request with insert parameter fails if target URI points the list

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • 5.0.10, 6.0.8, 7.0.4
    • 7.0.0, 7.0.1, 7.0.2, 7.0.3
    • restconf-nb

      POST requests inherently operate on parent resources in the path. This makes it impossible to utilize the `insert` query parameter in the desired manner.
      When the parent resource root (which is a container) is used, the application assigns the insert parameter to the container, rather than to the child list items which we intend to update.
      Example

      curl --location --request POST 'http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=17830-sim-device/yang-ext:mount/user-ordered-list:root?insert=last' \
      --header 'Accept: application/json' \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Basic YWRtaW46YWRtaW4=' \
      --header 'Cookie: JSESSIONID=node01orql8nxe3xvz18848b91d7c1z1.node0' \
      --data-raw '{
        "user-ordered-list:items": [
          {
            "id": 1,
            "name": "name"
          }
        ]
      }'

      Error Received:

      {
          "errors": {
              "error": [
                  {
                      "error-tag": "bad-element",
                      "error-message": "Insert parameter can be used only with list or leaf-list",
                      "error-type": "protocol"
                  }
              ]
          }
      }
      

      A similar situation arises when using a list as the parent resource. In this case, the application assigns the insert parameter to the parent list and demands an ordered-by-user statement.

            SamoSchneider Samuel Schneider
            yaroslav.lastivka Yaroslav Lastivka
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: