2 weeks ago
- last edited
2 weeks ago
You can do a lot of cool things with the API. One of the more common tasks an administrator can perform is accessing, updating and changing the firewall's configuration through some creative scripting while leveraging the ease of use of the API.
Just like the GUI and the CLI, accessing the API requires authentication. An authentication token can be generated and the resulting token can then be injected into any API command.
Let's see how we can use the above to get the configuration logs from a firewall using XML API.
First, you'll want to get the authentication token I talked about above. To get the token, simply open a browser and go to your firewall's address with the URL you see below. Change <hostname> with your firewall's IP address or actual hostname and change <username> and <password> with the actual username/password:
This long ORANGE string is the authentication key you will be using to perform the following API calls.
Let's see how you can use this key and get the config log at the same time.
You can use the API browse function to look through all the possible options, but just trust me when I tell you that for the config logs, the following query is the one you need (notice how I added the authentication key to the query):
Now you can use this job-id to get the actual log output. Just use the following syntax and notice how I use the job-id parameter in the query and also how I used the authentication key in the same query: