There are very little working examples of how to use the Barracuda API. Here’s how you can create a new domain using PowerShell:
$URL = “https://barracudaurl.com/cgi-mod/api.cgi?password=123”
$DomainName = “domain.com”
$Xml = “<methodCall>
<methodName>domain.add</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>domain</name>
<value>
<string><![CDATA[$DomainName]]></string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>”
$http_request = New-Object -ComObject Msxml2.XMLHTTP
$http_request.open(‘POST’, $URL, $false)
$http_request.setRequestHeader(“Content-type”, “text/xml”)
$http_request.setRequestHeader(“Content-length”, $Xml.length)
$http_request.setRequestHeader(“Connection”, “close”)
$http_request.send($Xml)
$http_request.statusText
$http_request.responseText
I’ll be adding an example of how to set the the domain properties next.
Hello,
How do I Obtain the list of all Available METHODS?
Thank you
It was so long ago that I did this, but I think I took a config back and opened up one of the files in a text editor to find all the fields. The file is not in XML format so it will take a while to get your head around how to format it. Also check this post which has all the fields required to manage a domain – http://www.lync.geek.nz/2013/09/barracuda-api-manage-domain-using.html