Hello Dominique
I consulted with @ReneMolenaar on this one, and there doesn’t seem to be a definite answer as there is no available explanation for it. The following explains why it is done like this:
From RFC8040 you’ll find the following explanation in section 4.1.1:
4.4.1. Create Resource Mode
If the target resource type is a datastore or data resource, then the
POST is treated as a request to create a top-level resource or child
resource, respectively. The message-body is expected to contain the
content of a child resource to create within the parent (target
resource). The message-body MUST contain exactly one instance of the
expected data resource. The data model for the child tree is the
subtree, as defined by YANG for the child resource.
This means that with a URL like this: https://10.65.90.105/restconf/data/ietf-interfaces:interfaces
We use a body like this:
{
"ietf-interfaces:interface": {
"name": "Loopback1",
"description": "RESTCONF-TEST",
"type": "iana-if-type:softwareLoopback",
"enabled": true,
"ietf-ip:ipv4": {
"address": [
{
"ip": "1.1.1.1",
"netmask": "255.255.255.0"
}
]
}
}
}
It is confusing, but as Rene mentioned to me, there’s no information that tells us why they came up with 4.4.1 as a requirement.
Although it is not a definitive answer, I hope this sheds some light on the subject!
Laz