Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Request a Single Configuration Object Using the Junos XML Protocol

In a Junos XML protocol session with a device running Junos OS, to request complete information about a single configuration object, a client application emits the <get-configuration> tag element that encloses the tag elements representing all levels of the configuration hierarchy from the root (represented by the <configuration> tag element) down to the immediate parent level for the object.

To represent the requested object, the application emits only the container tag element and each of its identifier tag elements, complete with identifier value, for the object. For objects with a single identifier, the <name> tag element can always be used, even if the actual identifier tag element has a different name. The actual name is also valid. For objects with multiple identifiers, the actual names of the identifier tag elements must be used. To verify the name of each of the identifiers for a configuration object, see the Junos XML API Configuration Developer Reference. The entire request is enclosed in an <rpc> tag element:

When the client application requests Junos XML-tagged output (the default), the Junos XML protocol server returns the requested object in <configuration> and <rpc-reply> tag elements. For information about the attributes in the opening <configuration> tag, see Specifying the Source for Configuration Information Requests in a Junos XML Protocol Session.

To specify the source of the output (candidate or active configuration) and request special formatting of the output (for example, formatted ASCII or JSON or an indicator for identifiers), the application can include attributes in the opening <get-configuration> tag, its opening <junoscript> tag, or both. For more information, see Specifying the Source for Configuration Information Requests in a Junos XML Protocol Session and Specifying the Output Format for Configuration Data in a Junos XML Protocol Session.

The application can also request additional configuration elements of the same or other types by including the appropriate tag elements in the same <get-configuration> tag element. For more information, see Requesting Multiple Configuration Elements Using the Junos XML Protocol.

The following example shows how to request the contents of one multicasting scope called local, which is at the [edit routing-options multicast] hierarchy level. To specify the desired object, the client application emits the <name>local</name> identifier tag element as the innermost tag element. The output is from the candidate configuration and is tagged with Junos XML tag elements (the default).