Changing Metric of Static Route using API

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing Metric of Static Route using API

L0 Member

All, trying to send a command via the API to change the metric value of a static route, this is because occassionally my primary connection is extremely slow, but doesnt fail so path monitoring doesnt remove the primary static route. I'd like to be able to integrate this into some other home automation I have.


I feel like I'm close, but cant seem to get the correct syntax from debug CLI ouput, I've done it with SET commands easily enough.




The below returns an error:


<response status="error" code="13">
<line>set failed, may need to override template object first</line>

My not working command:

https://FIREWALL/api?key=APIKEY&type=config&action=set&xpath=/config/devices/entry[@name='localhost.localdomain']/network/virtual-router/entry[@name='default']/routing-table/ip/static-route/entry[@name='Backup Default Route']/metric&element=<'entry name='200''/>


My Debug CLI output after successful SET command:

<request cmd="set" obj="/config/devices/entry[@name='localhost.localdomain']/network/virtual-router/entry[@name='default']/routing-table/ip/static-route/entry[@name='Backup Default Route']" cookie="7921424603090921"><metric>200</metric></request>


As a bonus, the commit command for the API would also be nice 🙂


Help would be appreciated.


Accepted Solutions

L4 Transporter

Hello @Kris.Pamphilon 


Try it with ...[@name='Backup Default Route']&element=<metric>200</metric>

View solution in original post


L4 Transporter

Hello @Kris.Pamphilon 


Try it with ...[@name='Backup Default Route']&element=<metric>200</metric>

Absoluletly perfect!


Thankyou very much!

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!