All property configuration rules are based on a set rule format, and each format's version defines the rules and their allowed values.

📘

By default, any new property you create uses the latest rule format and rule values.

To update your rule trees, add new rule trees, or set the rule format your property uses, get your rule tree, make your changes, and then activate your property to apply the changes on the network.

Get base IDs

You need your contract and group IDs to get your property's name to work with these commands. If you don't have them, use the commands below to find them.

IDCommand
ContractIDGet-Contracts
GroupIDGet-Groups
PropertyNameGet-Properties

Get rules

Get all of your property's rules at once or get smaller, focused objects called templates for specific rules.

Get all rules

Use your property's name and version to get its rule trees.

# Set the command to a variable to pull rules down as an object
$Rules = Get-PropertyRuleTree -PropertyName MyProperty -PropertyVersion latest
accountId : A-CCT1234
contractId : C-0N7RAC7
groupId : 12345
propertyId : 76543
propertyName : MyProperty
propertyVersion : 14
etag : exetag7888b96a6b6aeb49bec6ddcc823079b2e7
rules : @{name=default; children=System.Object[]; behaviors=System.Object[]; uuid=default; options=;  variables=System.Object[]; comments=The Default Rule template contains all the necessary and recommended  features. Rules are evaluated from top to bottom and the last matching rule wins.}
warnings : {@{type=https://problems.luna.akamaiapis.net/papi/v0/validation/incompatible_condition;  errorLocation=#/rules/children/3/children/9/behaviors/1; detail=Using `Set Variable` within a  match on response information
(such as origin response code) requires a thorough understanding of the way Akamai Edge  servers process requests, especially the
order of metadata stage execution. If you are unsure about how this will affect your  property, please contact your Akamai
Technical representative, and please test thoroughly on staging before activating on  production.}
ruleFormat : latest
comments : Demo

If you prefer to work with a JSON file, use the command with the -OutputToFile switch. Without a value, the switch creates a JSON file named {propertyName}_{propertyVersion}.json. To rewrite an existing JSON file, add on the file name and the -Force switch.

Get-PropertyRuleTree -PropertyName MyProperty -PropertyVersion latest -OutputToFile

Get rule templates

Working with all your property's rule trees in a PowerShell object or in a single JSON file is not ideal, especially when your updates are limited to just a few rules.

In this case, use the Get-PropertyRuleTemplates command. This will take your property's larger JSON file and split it into nested directories local to your shell, each containing smaller json files that are focused on specific rules as deep as they exist or at a depth you set.

  1. Get your property's rule templates.

    Get-PropertyRuleTemplates -PropertyName MyProperty -PropertyVersion latest
    
    Creating new property directory MyProperty
    Wrote version 4 of property MyProperty to MyProperty
    
    C:\CODE\MyProperty
    | Accelerate Delivery.json
    | Augment insights.json
    | Edgeworkers.json
    | Increase availability.json | main.json
    | Minimize payload.json
    | Offload origin.json
    | pmVariables.json
    | Shared Variables.json
    | Strengthen security.json
    |
    +---Accelerate Delivery
    | | Origin connectivity.json | | Prefetching.json
    | | Protocol Optimizations.json | |
    | \---Prefetching
    | | Prefetchable objects.json | | Prefetching objects.json | |
    | \---Prefetching objects | Bots.json
    |
    +---Augment insights
    | Content Targeting.json | GRN.json
    | Log delivery.json
    | mPulse RUM.json
    | Traffic reporting.json |
    +---Edgeworkers
    | Fail Action.json
    ...
    
  2. Add a template file to a variable to convert it to a manageable object.

    $EdgeworkersJson = Get-Content -Raw 'Edgeworkers.json" | ConvertFrom-JSON
    

Update rules

To update your rules, map to the rule and make changes or make changes to your JSON file.

Use object

  1. Make your changes.

    $Rules.rules.behaviors[0].options.hostname = "neworigin.example.com"
    $Rules.comments = "Updating origin hostname"
    

    There is no response, but you can verify your change by sending the mapped variable through your console.

    $Rules.comments
    
    Updating origin hostname
    
  2. Use the -RuleTree parameter with your variable to push your changes back to your property configuration or use a pipe.

    # Using the RuleTree parameter
    Set-PropertyRuleTree -PropertyName MyProperty -PropertyVersion latest -RuleTree $Rules
    
    # Using a pipe
    $Rules | Set-PropertyRuleTree -PropertyName MyProperty -PropertyVersion latest
    

Use JSON file

  1. Make changes to your JSON file(s) locally.

  2. Use the -InputFile parameter to push your changes back to your property configuration.

    Set-PropertyRuleTree -PropertyName MyProperty -PropertyVersion latest -InputFile MyProperty_4.json
    

Update rule formats

When you get your property's rule tree, your rules come down in the format annotated in the response.

To set or update your rule format, your rules need to be pulled down in that format.

  1. Get a list of available rule formats.

    List-RuleFormats
    
    v2022-10-18
    v2022-06-28
    v2021-09-22
    v2021-07-30
    v2020-11-02
    v2020-03-04
    v2019-07-25
    v2018-09-12
    v2018-02-27
    v2017-06-19
    v2016-11-15
    v2015-08-17
    latest
    
  2. Pull down your rules in the format you want by adding the -RuleFormat parameter with the format version as the value.

    Get-PropertyRuleTree -PropertyName MyProperty -PropertyVersion latest -RuleFormat v2022-10-18
    
  3. Make any changes needed.

  4. Push your rule format setting back out to your property configuration.

    Set-PropertyRuleTree -PropertyName MyProperty -PropertyVersion latest -RuleFormat v2022-10-18
    

If you don't need to make any changes to the default settings on a particular rule format, you can do both Get and Set at the same time.

# Here, the commands are set to a variable named $Rules
$Rules = Get-PropertyRuleTree -PropertyName MyProperty -PropertyVersion latest -RuleFormat v2022-10-18 $Rules | Set-PropertyRuleTree -PropertyName MyProperty -PropertyVersion latest -RuleFormat v2022-10-18

When you're done making changes, activate your property to get your changes to a network.

Activate property

To apply your rule tree or format changes on the network, you need to version and activate your property configuration.