Description
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.
Attachments
Issue Links
- relates to
-
NETCONF-1163 Create tests for POST "insert" query parameter
-
- Resolved
-
-
NETCONF-1180 PUT request with insert=after cannot add last item into list
-
- Confirmed
-
-
NETCONF-1177 PUT requests failing with "insert" query parameter on testool models
-
- Confirmed
-
Gerrit Reviews
| # | Subject | Branch | Project | Status | CR | V |
|---|---|---|---|---|---|---|
| 109196,9 | Fix POST request with insert parameter | master | netconf | Status: NEW | -1 | +1 |