Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Managing Junos Devices Using REST API

Widget Connector
urlhttps://www.youtube.com/watch?v=ZPKQUjSgw7k


https://www.juniper.net/documentation/en_US/junos/topics/example/rest-api-explorer-example.html


CLI Configuration

set system services rest http
set system services rest enable-explorer

...

( default port is 3000 )

J-WEB Configuration


Basic Restfull API request

http://172.30.95.178:3000/


Image Added
show commands

show security flow session | display xml rpc


Code Block
titleshow rpc commands
juniper@SDK-vSRX_JCL_EWF> show security flow session | display xml rpc
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/20.1R0/junos">
    <rpc>
        <get-flow-session-information>
        </get-flow-session-information>
    </rpc>
    <cli>
        <banner></banner>
    </cli>
</rpc-reply>





/rpc/get-flow-session-information
Security EWF

/rpc/show-web-filtering-status

/rpc/show-web-filtering-statistics




Config rpc comman


Code Block
titlecmd rpc
juniper@SDK-vSRX_JCL_EWF> show configuration security utm utm-policy SDK-Webfilter | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/20.1R0/junos">
    <configuration junos:commit-seconds="1605466556" junos:commit-localtime="2020-11-15 18:55:56 UTC" junos:commit-user="juniper">
            <security>
                <utm>
                    <utm-policy>
                        <name>SDK-Webfilter</name>
                        <web-filtering>
                            <http-profile>EVAL-EWF</http-profile>
                        </web-filtering>
                    </utm-policy>
                </utm>
            </security>
    </configuration>
    <cli>
        <banner></banner>
    </cli>
</rpc-reply>


Extract the config:

<configuration><security><utm><utm-policy><name>SDK-Webfilter3</name><web-filtering><http-profile>EVAL-EWF</http-profile></web-filtering></utm-policy></utm></security></configuration>

DELETE

https://www.juniper.net/documentation/en_US/junos/topics/task/configuration/junos-xml-protocol-configuration-data-elements-deleting.html

https://www.juniper.net/documentation/en_US/junos/topics/reference/tag-summary/junos-xml-protocol-delete-attribute.html

delete="delete"
<configuration><security><utm><utm-policy delete="delete" ><name>SDK-Webfilter3</name></utm-policy></utm></security></configuration>
REST-API explorer

Image Added


Image Added