URI structure
The URI path conveys a resource model that is similar to the YANG model, with each forward slash-separated path segment corresponding to a unique resource within the model's hierarchy (using the following syntax: <base_URI>/path1/path2/{key1},{key2}/path3/...).
For example, the URI "/rest/config/running/interface/ethernet" identifies the collection of Ethernet interfaces as target resources. In this example, from the path element..../interface onwards it represents the YANG model.
- rest - The entry point
- config - Represents the configuration datastore resource
- running - Represents the running configuration datastore
- interface - Represents all interfaces present in the running configuration
- ethernet - Represents all the Ethernet interfaces present in the running configuration
Similarly, the URI "/rest/config/running/interface/Port-channel/101" identifies the interface resource containing the Port-channel name101.
URI encoding
- A key that contains a forward slash (/) must be contained within a pair of double quotes("). The double quotes character is encoded as %22. For example, a value of 1/1 for {interface-name} is represented in a URI as "1/1", which is encoded as %221/1%22.
- The delimiter between adjacent keywords in URIs is a Comma (,). This is encoded as %2C.
Base URI
The base URI (http://host:port/rest/) is the entry point to access and manage all the resources defined in the system. The port is the default HTTP port (80). It is used to identify the base resource, and retrieves its first-level child resources of the base resource.
Note
A leaf attribute can also be present in the URI to identify the exact resource. For example, the URI http://host:port/rest/config/running/interface/port-channel/<po-id>/switch-port is used to identify the switch-port resource of the port-channel.
Top-level URIs
The URI identifies its first-level resource in its hierarchy with the given media type in its request; as shown in the following examples:
- http://<Base URI>/config/running - To access the running configuration resources.
- http://<Base URI>/operations - To access the YANG-RPC operation resources.
- http://<Base URI>/operational-state - To access the operational-state of the resources