cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
153
Views
0
Helpful
0
Replies
Highlighted
Cisco Employee

Special Chars in RESTconf URL

I've been trying to use special characters in the URL. I have used this for translation of interface:

In [3]: quote("TenGigE=0/0/1","=")

Out[3]: 'TenGigE=0%2F0%2F1'

And the REST call works fine:

(auto) MMALYSZ-M-60YE:452 mmalysz$ curl -isu admin:admin -X GET \

> -H "Content-type: application/yang-data+xml" \

> -H "Accept: application/yang-data+xml" \

> http://127.0.0.1:8080/restconf/data/devices/device=cisco0/config/interface/TenGigE=0%2F0%2F1

HTTP/1.1 200 OK

Server:

Date: Wed, 13 Dec 2017 14:13:25 GMT

Last-Modified: Wed, 13 Dec 2017 14:06:23 GMT

Cache-Control: private, no-cache, must-revalidate, proxy-revalidate

Etag: 1513-170834-522546

Content-Type: application/yang-data+xml

Transfer-Encoding: chunked

Pragma: no-cache

<TenGigE xmlns="http://tail-f.com/ned/cisco-ios-xr"  xmlns:cisco-ios-xr="http://tail-f.com/ned/cisco-ios-xr"  xmlns:ncs="http://tail-f.com/ns/ncs">

  <id>0/0/1</id>

  <description>test</description>

</TenGigE>

However for following special chars: "テスト"

In [1]: from requests.utils import quote

In [2]: quote("group=テスト","=")

Out[2]: 'group=%E3%83%86%E3%82%B9%E3%83%88'

I am getting an error:

(auto) MMALYSZ-M-60YE:452 mmalysz$ curl -isu admin:admin -X GET -H "Content-type: application/yang-data+xml" -H "Accept: application/yang-data+xml" http://127.0.0.1:8080/restconf/data/devices/authgroups/group=%E3%83%86%E3%82%B9%E3%83%88

HTTP/1.1 404 Not Found

Server:

Date: Wed, 13 Dec 2017 14:21:46 GMT

Cache-Control: private, no-cache, must-revalidate, proxy-revalidate

Content-Length: 229

Content-Type: application/yang-data+xml

Vary: Accept-Encoding

Pragma: no-cache

<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">

  <error>

    <error-message>uri keypath not found</error-message>

    <error-tag>invalid-value</error-tag>

    <error-type>application</error-type>

  </error>

</errors>

This group name with special char exists.

curl -isu admin:admin -X GET -H "Content-type: application/yang-data+xml" -H "Accept: application/yang-data+xml" http://127.0.0.1:8080/restconf/data/devices/authgroups/group

<authgroups xmlns="http://tail-f.com/ns/ncs"  xmlns:ncs="http://tail-f.com/ns/ncs">

  <group>

    <name>テスト</name>

  </group>

</authgroups>

What should be the right URL in my case?