- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
01-08-2019 03:08 AM - edited 01-08-2019 03:52 AM
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
01-08-2019 04:21 AM
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...
01-08-2019 04:08 AM - edited 01-08-2019 04:09 AM
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.).
01-08-2019 04:21 AM
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...
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!