Lets take this URL for example
https://<ip>/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1
If i send a request to a similar endpoint using the internal library we've been using the server doesn't understand it since the = is encoded to %3D but making the same request on the CLI with curl works fine.
I'm not understanding why it's an issue, isn't = supposed to be encoded in a URL anyway? Is it something to do with the library treating it as a query?
The
=
represents a special character with special meaning in a RESTCONF URI. If you encode it as%3D
, you take that special meaning away and reduce it to just a character. The only case where you would do that is when a list's key value or a leaf-list's value contain this character and you are referencing such an instance in your URI.You are only allowed to use
=
when referencing list and leaf-list instances - and you do not percent encode it when you do use it.In your case,
GigabitEthernet
would be expected to represent a list/leaf-list, with its key/type accepting1
as a valid value. Bothnative
andinterface
would be (and can only be) containers (or anydata).RFC8040, Section 3.5.3, Encoding Data Resource Identifiers in the Request URI describes this in detail.
Here are the examples from the same section:
Note the last example in particular. You would need to percent encode a
=
, if it appears afterlist1=
in its key value.Note that also that these are not parts of a query - they are path segments (RFC3986 terms).