Custom behaviors and overrides

The advanced features need to be configured separately for each property in which they appear. If you’d like to reuse an advanced behavior, ​Akamai​ can define a common custom object for you to reference from within many different rule trees.

When distributed to the edge network, all property settings convert to the executable format known as XML metadata. Advanced features deploy a portion of that XML metadata customized specifically for you, whose functionality falls outside the predefined guidelines of what other read/write behaviors can do. Suppose you have an advanced behavior whose xml does something useful:

{
  "name": "advanced",
  "uuid": "6c192451-f35f-4a8d-ad70-0e8fec521d99",
  "options": {
    "description": "Setting custom download receipt. Uses PMUSER_LOG variable.",
    "xml": "<reporting:edge-logging.send-receipt name=\"DLR\"><hostname>logs.customer.com</hostname><url>/dlr</url><allow-cacheh>off</allow-cacheh><status>on</status><port>443</port><format>stuff=%(PMUSER_LOG)&amp;time=%t&amp;url=%u</format><method>POST</method></reporting:edge-logging.send-receipt>"
  }
}

To apply it to many properties, contact your ​Akamai​ representative to configure the read-only XML as a custom behavior. Once ready, you run the List custom behaviors operation, choose the appropriate custom behavior, and store its behaviorId value:

{
    "accountId": "act_1-1TJZFB",
    "customBehaviors": {
        "items": [
            {
                "behaviorId": "cbe_12345",
                "name": "DLR",
                "displayName": "Custom Download Receipt",
                "description": "Setting custom download receipt. Uses PMUSER_LOG variable.",
                "status": "ACTIVE",
                "xml": "<reporting:edge-logging.send-receipt name=\"DLR\"><hostname>logs.customer.com</hostname><url>/dlr</url><allow-cacheh>off</allow-cacheh><status>on</status><port>443</port><format>stuff=%(PMUSER_LOG)&amp;time=%t&amp;url=%u</format><method>POST</method></reporting:edge-logging.send-receipt>",
                "updatedDate": "2017-04-24T12:34:56Z",
                "updatedByUser": "jdoe"
            }
        ]
    }
}

You can then insert a customBehavior to reference the common read-only metadata from within any rule tree, with no need to preserve a uuid value when exchanging the rule:

{
    "name": "customBehavior",
    "options": {
        "behaviorId": "cbe_12345",
        "name": "mdc"
    }
}

Custom overrides work much the same way as custom behaviors, but are meant to execute last in the rule tree. Typically, they add exceptions to the executed logic, either forcing alternative settings for specified cases, or reverting some changes that the rule tree may have modified along the way. Your ​Akamai​ representative creates a custom override on your behalf, which you then access with the List custom overrides operation. After choosing an overrideId from the list, you insert it into a customOverride region directly on the outer rule object:

{
    "rules": {
        "name": "default",
        "options": {
            "is_secure": false
        }
    },
    "customOverride": {
        "overrideId": "cbo_12345",
        "name": "mdc"
    }
}

Your ​Akamai​ representative can configure the customBehavior so that it sets up variables in the rule tree for the customOverride to use at the end of the configuration file. This way, you can use the full potential of the tailor-made advanced features.