REST Resources

/api/space/device-management/devices/{id}/exec-rpc (v1)

The following operation is supported on this resource:

  • POST - Perform RPC operations on a device
POST /devices/{id}/exec-rpcVersion 1

This API is used to perform RPC operations on a device. It executes the different RPC commands after opening a channel to a device and it sets the status of executed RPC commmands. This API takes a device ID and a netconf transfer object containing the RPC command to perform.

The different versions of this API take the RPC in the following formats:

  • Version 3 (Asynchronous): JSON version takes the RPC command in JSON format.
  • Version 2 (Asynchronous): JSON version takes the RPC command in XML format.
  • Version 1 (Synchronous): JSON version takes the RPC command in XML format.

Note: The RPC command to be executed must not contain any <> tags. For example the following is incorrect:

   ![CDATA[<rpc><get-system-information/><rpc/>]]

The following input is correct:

   ![CDATA[<get-system-information/>]]/p>.

Sample Usage

POST /devices/{id}/exec-rpc


  • Parameters:
    NameTypeURI TypeDescriptionRequired
    device-idIntegerPathThe ID of the device on which to perform the RPC operation. Y
  • Sample Input XML:

    Using CDATA
    <netconf>
      <rpcCommands>
        <rpcCommand>
          <![CDATA[<get-system-information/>]]>
        </rpcCommand>
      </rpcCommands>
    </netconf>

  • Sample Input XML:

    Using an Escape Sequence
    <netconf>
      <rpcCommands>
        <rpcCommand>
          <get-system-information/>
        </rpcCommand>
      </rpcCommands>
    </netconf>

  • Sample Output XML:

    <netconf>
      <status>Success</status>
      <rpcCommands>
         <rpcCommand>
           <get-system-information/>
        </rpcCommand>
      </rpcCommands>
      <netConfReplies>
        <netConfReply>
          <status>Success</status>
          <replyMsgData>
            <system-information>
              <hardware-model> srx100-lm</hardware-model>
              <os-name>junos-es& lt;/os-name>
              <os-version>10.0R2 .10</os-version>
              <serial-number> AT5109AF0621</serial-number>
              <host-name>hsc- srx_200</host-name>
            </system-information>
          </replyMsgData>
        </netConfReply>
      </netConfReplies>
      <deviceFamily>junos</deviceFamily>
      <isCluster>false</isCluster>
      <enableDiscardChanges>false</enableDiscardChanges>
      <netconfConfirmedCommit>false</netconfConfirmedCommit>
    </netconf>

  • Sample Input JSON:

    {
      "netconf":{
        "rpcCommands":{
          "rpcCommand": ["< get-system-information />"]
        }
      }
    }

  • Sample Output JSON:

    {
      "netconf": {
          "status":"Success",
          "rpcCommands":{
            "rpcCommand": "<get-system-information/>"
          },
          "netConfReplies":{
            "netConfReply":{
              "status":"Success",
              "replyMsgData":"
                <system-information>
                  <hardware-model>srx100-lm</hardware-model>
                  <os-name>junos-es</os-name>
                  <os-version>10.0R2.10</os-version>
                  <serial-number>AT5109AF0621</serial-number>
                  <host-name>hsc-srx_200</host-name>
                </system-information>\n"
              }
            },
            "deviceFamily":"junos",
            "isCluster": false,
            "enableDiscardChanges": false,
            "netconfConfirmedCommit": false
        }
      }

  • Access Control

    The following capabilities are required to access this API: OpenSSH

      For the current version of this API, refer to :
    • version 3