Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Request Configuration Data Using the Junos XML Protocol

In a Junos XML protocol session with a device running Junos OS, to request configuration data for a routing, switching, or security platform, a client application encloses the <get-configuration> element in an <rpc> tag. By setting optional attributes, the client application can specify the source and formatting of the configuration information returned by the Junos XML protocol server. By including the appropriate optional child tag elements, the application can request the entire configuration or specific portions of the configuration. The basic syntax is as follows:

Note:

To view configuration data in a specific instance of the ephemeral configuration database, a client application must open the ephemeral instance using the <open-configuration> operation with the appropriate child tags before executing the <get-configuration> request.

Note:

Starting in Junos OS Release 13.1, within a Junos XML protocol session, a logical system user can use the Junos XML protocol <get-configuration> operation to request specific logical system configuration hierarchies using child configuration tags as well as request the entire logical system configuration. When requesting the entire logical system configuration, the RPC reply includes the <configuration> root tag. Prior to Junos OS Release 13.1, the <configuration> root tag was omitted.

The Junos XML protocol server encloses its reply in an <rpc-reply> tag element. It includes attributes with the junos: prefix in the opening <configuration> tag to indicate when the configuration was last changed or committed and the user who committed it (the attributes appear on multiple lines in the syntax statement only for legibility). For more information about the attributes, see Specifying the Source for Configuration Information Requests in a Junos XML Protocol Session.

If a Junos XML tag element is returned within an <undocumented> tag element, the corresponding configuration element is not documented in the Junos OS configuration guides or officially supported by Juniper Networks. Most often, the enclosed element is used for debugging only by support personnel. In a smaller number of cases, the element is no longer supported or has been moved to another area of the configuration hierarchy, but appears in the current location for backward compatibility.

Note:

When displaying operational or configuration data that contains characters outside the 7-bit ASCII character set, Junos OS escapes and encodes these character using the equivalent UTF-8 decimal character reference. For more information see Understanding Character Encoding on Devices Running Junos OS.

For reference pages for the <configuration>, <configuration-json>, <configuration-set>, <configuration-text>, and <undocumented> tag elements, see the Junos XML API Operational Developer Reference.

Note:

If the client application locks the candidate configuration before making requests, it needs to unlock it after making its read requests. Other users and applications cannot change the configuration while it remains locked. For more information, see Locking and Unlocking the Candidate Configuration or Creating a Private Copy Using the Junos XML Protocol.

The following topics describe how a client application specifies the source, format, and amount of information returned by the Junos XML protocol server:

Applications can also request other configuration-related information, including an XML schema representation of the configuration hierarchy or information about previously committed configurations. For more information, see the following: