| [ Web Proxy ] |
| Viewing: https://developers.cloudflare.com/rules/compression-rules/create-api/ | [Back] [Original] |
Use the Rulesets API to create a compression rule via API.
When creating a compression rule via API, make sure you:
compress_response.action_parameters field according to the settings you wish to override for matching requests.http_response_compression phase at the zone level.Follow this workflow to create a compression rule for a given zone via API:
Use the List zone rulesets operation to check if there is already a ruleset for the http_response_compression phase at the zone level.
If the phase ruleset does not exist, create it using the Create a zone ruleset operation. In the new ruleset properties, set the following values:
zonehttp_response_compressionUse the Update a zone ruleset operation to add a compression rule to the list of ruleset rules. Alternatively, include the rule in the Create a zone ruleset request mentioned in the previous step.
For example API requests, refer to the Examples gallery.
| Web Proxy Viewer | New URL | Original Page |