- play_arrow Overview
- play_arrow Junos XML Management Protocol and Junos XML API Overview
- play_arrow Junos XML Protocol and Junos XML Tags Overview
- XML and Junos OS Overview
- XML Overview
- XML and Junos XML Management Protocol Conventions Overview
- Map Junos OS Commands and Command Output to Junos XML Tag Elements
- Map Configuration Statements to Junos XML Tag Elements
- Using Configuration Response Tag Elements in Junos XML Protocol Requests and Configuration Changes
- play_arrow Junos XML Protocol and JSON Overview
-
- play_arrow Manage Junos XML Protocol Sessions
- play_arrow Junos XML Protocol Session Overview
- play_arrow Manage Junos XML Protocol Sessions
- Satisfy the Prerequisites for Establishing a Connection to the Junos XML Protocol Server
- Configure clear-text or SSL Service for Junos XML Protocol Client Applications
- Connect to the Junos XML Protocol Server
- Start a Junos XML Protocol Session
- Authenticate with the Junos XML Protocol Server for Cleartext or SSL Connections
- Send Requests to the Junos XML Protocol Server
- Parse the Junos XML Protocol Server Response
- Parse Response Tag Elements Using a Standard API in NETCONF and Junos XML Protocol Sessions
- How Character Encoding Works on Juniper Networks Devices
- Handle an Error or Warning in Junos XML Protocol Sessions
- Halt a Request in Junos XML Protocol Sessions
- Lock, Unlock, or Create a Private Copy of the Candidate Configuration Using the Junos XML Protocol
- Terminate a Junos XML Protocol Session
- End a Junos XML Protocol Session and Close the Connection
- Sample Junos XML Protocol Session
- play_arrow Junos XML Protocol Tracing Operations
- play_arrow Junos XML Protocol Operations
- play_arrow Junos XML Protocol Processing Instructions
- play_arrow Junos XML Protocol Response Tags
- play_arrow Junos XML Element Attributes
- active
- count
- delete
- inactive
- insert
- junos:changed
- junos:changed-localtime
- junos:changed-seconds
- junos:commit-localtime
- junos:commit-seconds
- junos:commit-user
- junos:group
- junos:interface-range
- junos:key
- junos:position
- junos:total
- matching
- protect
- recurse
- rename
- replace
- replace-pattern
- start
- unprotect
- xmlns
-
- play_arrow Manage Configurations Using the Junos XML Protocol
- play_arrow Change the Configuration Using the Junos XML Protocol
- Request Configuration Changes Using the Junos XML Protocol
- Upload and Format Configuration Data in a Junos XML Protocol Session
- Upload Configuration Data as a File Using the Junos XML Protocol
- Upload Configuration Data as a Data Stream Using the Junos XML Protocol
- Define the Format of Configuration Data to Upload in a Junos XML Protocol Session
- Specify the Scope of Configuration Data to Upload in a Junos XML Protocol Session
- Replace the Configuration Using the Junos XML Protocol
- Create, Modify, or Delete Configuration Elements Using the Junos XML Protocol
- Create New Elements in Configuration Data Using the Junos XML Protocol
- Merge Elements in Configuration Data Using the Junos XML Protocol
- Replace Elements in Configuration Data Using the Junos XML Protocol
- Replace Only Updated Elements in Configuration Data Using the Junos XML Protocol
- Delete Elements in Configuration Data Using the Junos XML Protocol
- Rename Objects In Configuration Data Using the Junos XML Protocol
- Reorder Elements In Configuration Data Using the Junos XML Protocol
- Protect or Unprotect a Configuration Object Using the Junos XML Protocol
- Change a Configuration Element’s Activation State Using the Junos XML Protocol
- Change a Configuration Element’s Activation State Simultaneously with Other Changes Using the Junos XML Protocol
- Replace Patterns in Configuration Data Using the NETCONF or Junos XML Protocol
- play_arrow Commit the Configuration on a Device Using the Junos XML Protocol
- Verify Configuration Syntax Using the Junos XML Protocol
- Commit the Candidate Configuration Using the Junos XML Protocol
- Commit a Private Copy of the Configuration Using the Junos XML Protocol
- Commit a Configuration at a Specified Time Using the Junos XML Protocol
- Commit the Candidate Configuration Only After Confirmation Using the Junos XML Protocol
- Commit and Synchronize a Configuration on Redundant Control Planes Using the Junos XML Protocol
- Log a Message About a Commit Operation Using the Junos XML Protocol
- View the Configuration Revision Identifier for Determining Synchronization Status of Devices with NMS
- play_arrow Ephemeral Configuration Database
- Understanding the Ephemeral Configuration Database
- Unsupported Configuration Statements in the Ephemeral Configuration Database
- Enable and Configure Instances of the Ephemeral Configuration Database
- Commit and Synchronize Ephemeral Configuration Data Using the NETCONF or Junos XML Protocol
- Managing Ephemeral Configuration Database Space
-
- play_arrow Junos XML Protocol Utilities
- play_arrow Develop Junos XML Protocol C Client Applications
-
- play_arrow Configuration Statements and Operational Commands
Specify the Output Format for Configuration Data in a Junos XML Protocol Session
In a Junos XML protocol session with a device running Junos
OS, to request information about a configuration on a routing, switching,
or security platform, a client application encloses the <get-configuration>
element in an <rpc>
tag. The client application can specify the formatting of the configuration
data returned by the Junos XML protocol server by setting optional
attributes in the <get-configuration>
tag.
To request that the Junos XML protocol server return
configuration information in Junos XML-tagged output, the client application
either includes the format="xml"
attribute
in the <get-configuration/>
tag or opening <get-configuration>
tag or omits the attribute completely.
The Junos XML protocol server returns Junos XML-tagged output by default,
except when the compare
attribute is included.
<rpc> <get-configuration/> <!-- OR --> <get-configuration> <!-- tag elements for the configuration elements to return --> </get-configuration> </rpc>
To request that the Junos XML protocol server return
configuration information as formatted ASCII text instead of tagging
it with Junos XML tag elements, the client application includes the format="text"
attribute in the <get-configuration/>
tag or opening <get-configuration>
tag.
<rpc> <get-configuration format="text"/> <!-- OR --> <get-configuration format="text"> <!-- tag elements for the configuration elements to return --> </get-configuration> </rpc>
Starting in Junos
OS Release 15.1, the client application includes the format="set"
attribute in the <get-configuration/>
tag or opening <get-configuration>
tag to request that the Junos XML protocol server return configuration
information as configuration mode set
commands instead
of Junos XML tag elements. The client application
encloses the request in an <rpc>
tag
element.
<rpc> <get-configuration format="set"/> <!-- OR --> <get-configuration format="set"> <!-- tag elements for the configuration elements to return --> </get-configuration> </rpc>
Starting in Junos OS Release 14.2, a client application
can request that the Junos XML protocol server return configuration
information in JavaScript Object Notation (JSON) format. To return
configuration data in JSON format instead of tagging it with Junos
XML tag elements, the client application includes the format="json"
attribute in the <get-configuration/>
tag or opening <get-configuration>
tag. The client application encloses the request in an <rpc>
tag element.
<rpc> <get-configuration format="json"/> <!-- OR --> <get-configuration format="json"> <!-- tag elements for the configuration elements to return --> </get-configuration> </rpc>
For information about the tag elements to enclose in the <get-configuration>
tag element, see Specifying the Scope of Configuration Data to Return
in a Junos XML Protocol Session.
Regardless of which output format they request, client
applications use Junos XML tag elements to represent the configuration
elements to display. The format
attribute
controls the format of the Junos XML protocol server’s output
only.
When the application requests Junos XML tag elements,
the Junos XML protocol server encloses its output in <rpc-reply>
and <configuration>
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.
<rpc-reply xmlns:junos="URL"> <configuration attributes> <!-- Junos XML tag elements representing configuration elements --> </configuration> </rpc-reply>
When the application requests formatted ASCII output,
the Junos XML protocol server formats its response in the same way
that the CLI show configuration
command displays configuration
data—it uses the newline character, tabs, braces, and square
brackets to indicate the hierarchical relationships between configuration
statements. The server encloses formatted ASCII configuration statements
in <rpc-reply>
and <configuration-text>
tag elements.
<rpc-reply xmlns:junos="URL"> <configuration-text> <!-- formatted ASCII configuration statements --> </configuration-text> </rpc-reply>
When the application requests configuration mode set
commands, the Junos XML protocol server formats its response
in the same way that the CLI show configuration | display
set
command displays configuration data. The server encloses
the data in <rpc-reply>
and <configuration-set>
tag elements.
<rpc-reply xmlns:junos="URL"> <!-- configuration mode commands --> </rpc-reply>
When the application requests JSON format, the Junos
XML protocol server encloses the JSON data in <rpc-reply>
and <configuration-json>
tag elements.
<rpc-reply xmlns:junos="URL"> <configuration-json> <!-- JSON configuration data --> </configuration-json> </rpc-reply>
Starting in Junos OS Release 16.1, devices running Junos OS emit JSON-formatted configuration data using a new default implementation for serialization.
Starting in Junos OS Releases 16.1R4, 16.2R2, and 17.1R1, integers in Junos OS configuration data emitted in JSON format are not enclosed in quotation marks. In earlier releases, integers in JSON configuration data are treated as strings and enclosed in quotation marks.
The format
attribute can be combined
with one or more of the following other attributes in the <get-configuration/>
tag or opening <get-configuration>
tag:
compare
with the valuecompare="rollback"
and withrollback="0"
. When you compare the candidate configuration to the active configuration (rollback="0"
), you can display the differences in formats other than text by including the appropriate value for theformat
attribute in the request. You can display the differences in XML format starting in Junos OS Release 15.1R1, and you can display the differences in JSON format starting in Junos OS Release 16.1R1.commit-scripts
with a value ofcommit-scripts="apply"
orcommit-scripts="apply-no-transients"
. Thecommit-scripts="view"
attribute returns Junos XML-tagged output by default, even if theformat="text"
attribute is included, since this is the format that is input to commit scripts.database
, which is described in Specifying the Source for Configuration Information Requests in a Junos XML Protocol Sessioninherit
and optionallygroups
andinterface-ranges
, which are described in Specifying the Output Format for Configuration Groups and Interface Ranges Using the Junos XML Protocol
It does not make sense to combine the format="text"
attribute with the changed
attribute
(described in Requesting Change Indicators
for Configuration Elements Using the Junos XML Protocol) or to include it after requesting an indicator for identifiers
(described in Requesting Identifier Indicators
for Configuration Elements Using the Junos XML Protocol). The change and identifier indicators appear only in Junos XML-tagged
and JSON output.
An application can request Junos-XML tagged output, formatted
ASCII text, configuration mode set
commands, or JSON output
for the entire configuration or any portion of it. For instructions
on specifying the amount of data to return, see Specifying the Scope of Configuration Data to Return
in a Junos XML Protocol Session.
The following example shows how to request formatted ASCII output
from the [edit policy-options]
hierarchy level in
the candidate configuration.

Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.
format="set"
attribute in the <get-configuration/>
tag or opening <get-configuration>
tag to request that the Junos XML protocol server return configuration
information as configuration mode set
commands instead
of Junos XML tag elements.