The Sample bulk updates section briefly summarizes some of the PAPI behaviors you may want to search for in your configuration. This section provides a fuller set of examples showing different techniques to help refine your search.
Examples in the table below demonstrate how to restrict matches to top-level default rules, child rules, or match based on nearby criteria or behaviors. It shows how to match or exclude string values, pattern-match a regular expression, or test boolean, numeric, or array values.
The additional section on Possible mismatches provides further guidance on potential conceptual errors to help you avoid matching content incorrectly.
Match | JSONPath syntax |
---|---|
Location within rules | |
Origin hostname in top-level default rule. | $.behaviors[?(@.name == 'origin')].options.hostname |
Origin hostname in any rule. | $..behaviors[?(@.name == 'origin')].options.hostname |
Origin hostname, only in child rules. | $..children[*].behaviors[?(@.name == 'origin')].options.hostname |
Boolean values | |
Toggle HTTP/2, when either enabled or disabled. | $..behaviors[?(@.name == 'http2')].options.enabled |
Edge Redirector, disabled. | $..behaviors[?(@.name == 'edgeRedirector')].options[?(@.enabled == false)].enabled |
Edge Redirector, enabled. | $..behaviors[?(@.name == 'edgeRedirector')].options[?(@.enabled == true)].enabled |
Forward Rewrite or Edge Redirector, enabled or disabled. | `$..behaviors[?(@.name == 'forwardRewrite' |
String values | |
Origin hostname of www.example.com . | $..behaviors[?(@.name == 'origin')].options[?(@.hostname == 'www.example.com')].hostname |
Any origin hostname that matches an example.com substring. | $..behaviors[?(@.name == 'origin')].options[?(@.hostname =~ /example.com/)].hostname |
Any origin hostname that starts with www. and ends .com . | $..behaviors[?(@.name == 'origin')].options[?(@.hostname =~ /www\..*\.com/)].hostname |
Default caching TTL. | $..behaviors[?(@.name == 'caching')].options.defaultTtl |
Same, but cached 1 to 9 hours. | $..behaviors[?(@.name == 'caching' && @.options.defaultTtl =~ /^[1-9]h$/)].options.defaultTtl |
Numeric values | |
Any response code. | $..behaviors[?(@.name == 'responseCode')].options.statusCode |
Response code is 200. | $..behaviors[?(@.name == 'responseCode')].options[?(@.statusCode == 200)].statusCode |
Error response codes. | $..behaviors[?(@.name == 'responseCode')].options[?(@.statusCode >= 400)].statusCode |
Redirect responses in 3xx range. | $..behaviors[?(@.name == 'responseCode')].options[?(@.statusCode >= 300 && @.statusCode < 400)].statusCode |
Array values | |
Path criteria match that includes /catalog . | $..criteria[?(@.name == 'path')].options.value[?(@ == '/catalog')] |
All path match values except /catalog . | $..criteria[?(@.name == 'path')].options.value[?(@ != '/catalog')] |
All path match values. | $..criteria[?(@.name == 'path')].options.value[*] |
First path match value. | $..criteria[?(@.name == 'path')].options.value[0] |
Last path match value. | $..criteria[?(@.name == 'path')].options.value[-1] |
Any /catalog path value in the same set as an /about value. | $..criteria[?(@.name == 'path')].options[?('/about' in @.value)].value[?(@ == '/catalog')] |
Any /catalog path value where /blog isn't in the same set. | $..criteria[?(@.name == 'path')].options[?('/blog' nin @.value)].value[?(@ == '/catalog')] |
Specific set of path values. | `$..criteria[?(@.name == 'path')].options.value[?(@ == '/catalog' |
Relative location | |
Toggle Image Manager within any rule with image in its name. | $..children[?(@.name =~ /[Ii]mage/)].behaviors[?(@.name == 'imageManager')].options.enabled |
Toggle a matchWildcard option within a contentType match that enables a gzipResponse behavior. | $.[?(@.criteria.[?(@.name == 'contentType')] && @.behaviors.[?(@.name == 'gzipResponse')])].criteria[?(@.name == 'contentType')].options.matchWildcard |
Set the Downstream Cacheability behavior when triggered by a Response Cacheability criteria match. | $..children[?(@.criteria[?(@.name == 'cacheability')] && @.behaviors[?(@.name == 'downstreamCache')] )].behaviors[?(@.name == 'downstreamCache')].options.behavior |