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

API call via curl

Hi folks,

I had some trouble with SFOS 18.0.4 regarding IPSec-Connections with dynamic ip, see here.

To create a workaround I dived a bit deeper into the Sophos XG API to bring the connection down and up again manually but scripted.

I created the API request with following strings to cut down the connection:

https://DNSofXG:4444/webconsole/APIController?reqxml=<Request><Login><Username>apiadmin</Username>
<Password passwordform="encrypt">XXXXX</Password></Login><Set><VPNIPSecConnection><DisConnection>
<Name>NameOfIPSecConnection</Name></DisConnection></VPNIPSecConnection></Set></Request>

The request is working softly while it is triggered by my web browser (Chromium Edge) but it is not working with curl!

My plan is to trigger the XML API request via curl from a linux-machine like this:

https://DNSofXG:4444/webconsole/APIController?reqxml=<Request><Login>
<Username>apiadmin</Username><Password passwordform="encrypt">XXXXX</Password>
</Login><Set><VPNIPSecConnection><DisConnection><Name>NameOfIPSecConnection</Name>
</DisConnection></VPNIPSecConnection></Set></Request>

But the request is running into.

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

Tried to put the IP adress instead of dns but still the same output with curl.

Help needed from you, guys!



This thread was automatically locked due to age.
Parents
  • Made it work either using a file:

    curl -k https://DNSofXG:4444/webconsole/APIController -F "reqxml=<xmlfilename.xml"

    or using the command directly with curl on cli

    curl -k "https://DNSofXG:4444/webconsole/APIController" -d 'reqxml=<Request><Login><Username>apiadmin</Username><Password passwordform="encrypt">myencryptedpw</Password></Login><Set><VPNIPSecConnection><DisConnection><Name>ipsec_connectionname</Name></DisConnection></VPNIPSecConnection></Set></Request>'

    Thanks to for the help

  • FormerMember
    0 FormerMember in reply to njabi

    Glad to hear that an issue has been resolved.

Reply Children
No Data