This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Trying to use the API to bulk create static routes

I'm trying to create unicast routes using the API.

#This is my 'routes.xml'

<Request>
<Login>
<Username>admin</Username>
<Password>admin</Password>
</Login>
<Set operation="add">
<UnicastRoute transactionid="">
<IPFamily>IPv4</IPFamily>
<DestinationIP>192.168.1.50</DestinationIP>
<Netmask>255.255.255.255</Netmask>
<Gateway>10.0.0.1</Gateway>
<Interface>PortB</Interface>
<Distance>0</Distance>
</UnicastRoute>
</Set>
</Request>

 

# My bash script to create an API request against the XG

#!/bin/bash

xml=$(tr -d '\r\n\t' <route.xml | tr -d ' ')

# Print curl request for debug
echo curl -k "172.16.16.16/.../APIController
curl -k "https://172.16.16.16/webconsole/APIController?reqxml=$xml"

 

# If i try run this

root@KROSE:~/sophos# ./run.sh
curl -k 172.16.16.16/.../APIController

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Status code="529">Input request file is Invalid</Status>
</Response>

The xml looks 'ok' to my eyes, but i could be missing something. Can someone help please? :-)



This thread was automatically locked due to age.