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

RESTful API and PowerShell Scripting

Anybody have some experiences with that?

I'd like to have a Powershell-Script that enables/disables Firewall or NAT Rules -> that means for example do this curl:

 

curl -X PATCH --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic dG9rZW46WmZqblZtZkd0bVppZ3lYRURLZkJRZWl1dnpqRUlTTFM=' -d '{"auto_pf_in":"","auto_pfrule":false,"comment":"","destination":"","destination_nat_address":"","destination_nat_service":"","group":"","ipsec":false,"log":false,"mode":"none","name":"","service":"","source":"","source_nat_address":"","source_nat_service":"","status":true}' 'https://utm.local:4444/api/objects/packetfilter/nat/REF_PacNatHttpsFromAny'


I did already search a little bit and I found out that I have to use the Invoke-RestMethod with Powershell. I'm able to do GET things with powershell now but I don't know how to do PATCH or POST Things with Powershell...

Anybody can help?


regards


This thread was automatically locked due to age.
Parents Reply
  • Thanks, we found out that it simple was a syntax mistake (missing $) with powershell...

    We're able to switch NAT-/Firewallrules, WLAN-Networks... on/off now with one Powershell Script (-> check and change the current status on<->off) :-)

     

    If anybody is interested ->pm or answer here

     

    regards

Children
No Data