API + (new) zones

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

API + (new) zones

L1 Bithead

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

1 accepted solution

Accepted Solutions

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

2 REPLIES 2

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.).

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...

  • 1 accepted solution
  • 1968 Views
  • 2 replies
  • 0 Likes
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 LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!