API + (new) zones

Announcements

ATTENTION Customers, All Partners and Employees: The Customer Support Portal (CSP) will be undergoing maintenance and unavailable on Saturday, November 7, 2020, from 11 am to 11 pm PST. Please read our blog for more information.

Reply
Highlighted
L1 Bithead

API + (new) zones

Hey all,

 

i have started to work with the API and Postman lately in order help with making the setup process of new boxes a little easier & faster. While I have been able to get most of the basics done (Management IP, DNS, NTP, etc.) I am now struggling with creating new objects in the configuration through the API, starting with the zones that I want to use.

 

When I run some tests and use "get" in order to check for some existing objects everything seems to work fine, but as soon as I switch to "set" and try to define new objects I always get a "Malformed Request" feedback through Postman.

 

Here is one example I have used for testing today:

 

https://{{HOST}}/api/?type=config&key={{key}}&action=set&xpath=/config/devices/entry/vsys/entry/zone/entry[@name='{{zone-intern}}']&element=<network><layer3><member>ethernet1/3</member></layer3></network>

 

Any clues on how to approach those issues (not for zone settings only)? Are there any elementy that MUST be included (like the network type) when creating certain objects that are documented somewhere?

 

Thanks!

Torsten

 

edit: corrected a mistake in the code part


Accepted Solutions
Highlighted
L1 Bithead

Ok, found it. Only had to swap some details around.

 

https://{{HOST}}/api/?type=config&key={{key}}&action=set&xpath=/config/devices/entry/vsys/entry/zone/entry[@name='{{zone-dmz}}']&element=<network><layer3><member>ethernet1/3</member></layer3></network>

Now to optimize this whole setup...

View solution in original post


All Replies
L1 Bithead

Update: made a little progress, been testing around with using the "complete" action for a bit and seeing what next commands I could use or try out. Am now able to at least create the zone using this command:

 

https://{{HOST}}/api/?type=config&key={{key}}&action=set&xpath=/config/devices/entry/vsys/entry/zone&element=<entry name='{{zone-dmz}}'/>

Now to find a way to add additional configuration elements (layer, interface, etc.).

Highlighted
L1 Bithead

Ok, found it. Only had to swap some details around.

 

https://{{HOST}}/api/?type=config&key={{key}}&action=set&xpath=/config/devices/entry/vsys/entry/zone/entry[@name='{{zone-dmz}}']&element=<network><layer3><member>ethernet1/3</member></layer3></network>

Now to optimize this whole setup...

View solution in original post

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 Live Community as a whole!

The Live Community thanks you for your participation!