For a primer on how to Create a Policy, visit this link:
For information on how to run a Policy via the gPanel user interface, see here:
With the policy API endpoint, we now have the ability to run a policy via an API call.
The definitive documentation for this API endpoint is in the developer portal. This is where you will find the technical details, such as which HTTP verb to use, and what parameters you need to provide.
Form your API Request
The gPanel Application can help us form our API request. Locate the Standard policy you wish to invoke, and view the policy details by clicking the double arrows.
The Policy Details view will show two relevant pieces of information that will help you form your API call.
Visiting the docs in the developer portal shows me that this API request takes one parameter via a POST body:
Using all of this information, we can now form our request. Be sure to plugin your own values for policyId and apikey.
Here is a sample curl command:
A successful response (HTTP response code 2xx) means that your request was received and gPanel will run your policy. Note, however, that a successful response from your API call does not mean that your policy ran successfully to completion.
Your policy is being run asynchronously as a background task in gPanel. To gain insight into the outcome of the policy execution, visit the gPanel application.