<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Retrieving information with RESTCONF in Tools</title>
    <link>https://community.cisco.com/t5/tools/retrieving-information-with-restconf/m-p/5299380#M3675</link>
    <description>&lt;P&gt;Hello, everyone.&lt;/P&gt;
&lt;P&gt;I am studying RESTCONF for my ENCOR Exam and I have a question about how the URL is formatted.&lt;/P&gt;
&lt;P&gt;I have the following code here:&lt;/P&gt;
&lt;PRE&gt;import requests
from rich import print as rprint

headers = {
    "Accept": "application/yang-data+json"
}

url = "https://192.168.170.200:443/restconf/data/Cisco-IOS-XE-native:native/hostname"

response = requests.get(url=url, headers=headers, auth=("admin", "cisco"), verify=False)
rprint(response.json())&lt;/PRE&gt;
&lt;P&gt;The URL is my cisco router running in Cisco CML. This code will return the hostname of the device&lt;/P&gt;
&lt;PRE&gt;{'Cisco-IOS-XE-native:hostname': 'R1'}&lt;/PRE&gt;
&lt;P&gt;I have a question about how the URL is formatted. The &lt;STRONG&gt;Cisco-IOS-XE-native&amp;nbsp;&lt;/STRONG&gt;is a YANG model that is used to interact/retrieve the running configuration of the device.&lt;/P&gt;
&lt;P&gt;Inside the Cisco-IOS-XE-native YANG model, everything is stored inside the&amp;nbsp;&lt;STRONG&gt;native&amp;nbsp;&lt;/STRONG&gt;object/container.&lt;/P&gt;
&lt;P&gt;1. My first question is, why can't I just use a URL like this to retrieve the running configuration?&lt;BR /&gt;&lt;A href="https://192.168.170.200:443/restconf/data/" target="_blank" rel="noopener"&gt;https://192.168.170.200:443/restconf/data/&lt;/A&gt;&lt;STRONG&gt;Cisco-IOS-XE-native&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;It only works if I do this: &lt;BR /&gt;&lt;A href="https://192.168.170.200:443/restconf/data/" target="_blank" rel="noopener"&gt;https://192.168.170.200:443/restconf/data/&lt;/A&gt;&lt;STRONG&gt;Cisco-IOS-XE-native:native.&amp;nbsp;&lt;BR /&gt;&lt;/STRONG&gt;Is it always necessary to add in the container that stores everything?&lt;/P&gt;
&lt;P&gt;2. If I want to retrieve something more specific like the version, the URL looks the following:&amp;nbsp;&lt;BR /&gt;&lt;A href="https://192.168.170.200:443/restconf/data/" target="_blank" rel="noopener"&gt;https://192.168.170.200:443/restconf/data/&lt;/A&gt;&lt;STRONG&gt;Cisco-IOS-XE-native:native/hostname&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;What's confusing me is what a double collon &lt;STRONG&gt;:&lt;/STRONG&gt; and the forward slash&amp;nbsp;&lt;STRONG&gt;/&amp;nbsp;&lt;/STRONG&gt;achieve. Why is there a double collon with &lt;STRONG&gt;:native&lt;/STRONG&gt; but a forward slash with&amp;nbsp;&lt;STRONG&gt;/hostname?&lt;/STRONG&gt; When is which one used?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
    <pubDate>Sun, 15 Jun 2025 11:04:37 GMT</pubDate>
    <dc:creator>Mitrixsen</dc:creator>
    <dc:date>2025-06-15T11:04:37Z</dc:date>
    <item>
      <title>Retrieving information with RESTCONF</title>
      <link>https://community.cisco.com/t5/tools/retrieving-information-with-restconf/m-p/5299380#M3675</link>
      <description>&lt;P&gt;Hello, everyone.&lt;/P&gt;
&lt;P&gt;I am studying RESTCONF for my ENCOR Exam and I have a question about how the URL is formatted.&lt;/P&gt;
&lt;P&gt;I have the following code here:&lt;/P&gt;
&lt;PRE&gt;import requests
from rich import print as rprint

headers = {
    "Accept": "application/yang-data+json"
}

url = "https://192.168.170.200:443/restconf/data/Cisco-IOS-XE-native:native/hostname"

response = requests.get(url=url, headers=headers, auth=("admin", "cisco"), verify=False)
rprint(response.json())&lt;/PRE&gt;
&lt;P&gt;The URL is my cisco router running in Cisco CML. This code will return the hostname of the device&lt;/P&gt;
&lt;PRE&gt;{'Cisco-IOS-XE-native:hostname': 'R1'}&lt;/PRE&gt;
&lt;P&gt;I have a question about how the URL is formatted. The &lt;STRONG&gt;Cisco-IOS-XE-native&amp;nbsp;&lt;/STRONG&gt;is a YANG model that is used to interact/retrieve the running configuration of the device.&lt;/P&gt;
&lt;P&gt;Inside the Cisco-IOS-XE-native YANG model, everything is stored inside the&amp;nbsp;&lt;STRONG&gt;native&amp;nbsp;&lt;/STRONG&gt;object/container.&lt;/P&gt;
&lt;P&gt;1. My first question is, why can't I just use a URL like this to retrieve the running configuration?&lt;BR /&gt;&lt;A href="https://192.168.170.200:443/restconf/data/" target="_blank" rel="noopener"&gt;https://192.168.170.200:443/restconf/data/&lt;/A&gt;&lt;STRONG&gt;Cisco-IOS-XE-native&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;It only works if I do this: &lt;BR /&gt;&lt;A href="https://192.168.170.200:443/restconf/data/" target="_blank" rel="noopener"&gt;https://192.168.170.200:443/restconf/data/&lt;/A&gt;&lt;STRONG&gt;Cisco-IOS-XE-native:native.&amp;nbsp;&lt;BR /&gt;&lt;/STRONG&gt;Is it always necessary to add in the container that stores everything?&lt;/P&gt;
&lt;P&gt;2. If I want to retrieve something more specific like the version, the URL looks the following:&amp;nbsp;&lt;BR /&gt;&lt;A href="https://192.168.170.200:443/restconf/data/" target="_blank" rel="noopener"&gt;https://192.168.170.200:443/restconf/data/&lt;/A&gt;&lt;STRONG&gt;Cisco-IOS-XE-native:native/hostname&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;What's confusing me is what a double collon &lt;STRONG&gt;:&lt;/STRONG&gt; and the forward slash&amp;nbsp;&lt;STRONG&gt;/&amp;nbsp;&lt;/STRONG&gt;achieve. Why is there a double collon with &lt;STRONG&gt;:native&lt;/STRONG&gt; but a forward slash with&amp;nbsp;&lt;STRONG&gt;/hostname?&lt;/STRONG&gt; When is which one used?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jun 2025 11:04:37 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/retrieving-information-with-restconf/m-p/5299380#M3675</guid>
      <dc:creator>Mitrixsen</dc:creator>
      <dc:date>2025-06-15T11:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving information with RESTCONF</title>
      <link>https://community.cisco.com/t5/tools/retrieving-information-with-restconf/m-p/5299394#M3676</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1297969"&gt;@Mitrixsen&lt;/a&gt;&amp;nbsp;&lt;SPAN&gt;the top level container is typically named after the module, or has a well known name like "native" here in XE. It fails does not work with Cisco-IOS-XE-native cos this is a module name (not a data node) restconf&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;expects this to point to an actual data node (container, list, leaf etc…)&amp;nbsp;&lt;SPAN&gt;you generally always need to specify the top level container after the module name.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;The : separates the module name from the node name. Like you had native:native, this is when you need to qualify a node with its module namespace.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;The / separates path components in the data hierarchy. So say native/hostname, this is inside the native container, and the leaf access of the host name. I recall this information this way:&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Use the :&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;when you need to specify which module a node comes from and use /&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;to navigate through the hierarchy of containers/lists/leaves.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope this helps!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jun 2025 12:10:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/retrieving-information-with-restconf/m-p/5299394#M3676</guid>
      <dc:creator>bigevilbeard</dc:creator>
      <dc:date>2025-06-15T12:10:17Z</dc:date>
    </item>
  </channel>
</rss>

