Announcing Property Manager Variables

by Jay Sikkeland
2483

Property Manager now includes support for variables, providing additional control and self serviceability. Variables work with all Akamai products that are configured using Property Manager, and are fully supported by the Property Manager API (PAPI).

If you’ve done any kind of programming and have some experience with the Property Manager configuration tool, you’ll find variables fairly intuitive. Typical uses for variables include:

  • Simplify configurations by reducing the number of rules and behaviors.
  • Improve self serviceability by replacing or extending advanced metadata.
  • Automate redirects, forward path rewrites, HTTP header and cookie manipulation.
  • Move origin functionality to the edge.

In this blog post I’ll show you a use case that sets Property Manager variables in the user interface, and then for API developers, I’ll show you a snippet that does the same thing in code.

Example Use Case – Replace Query String Value using Regex

In this example, I’m going to replace the value of an incoming request query string “foo” with some arbitrary value, and then issue a 302 redirect to the new url. Surprisingly, I’ll use the value “bar” in this example, but it could be anything, including a variable.

  • Incoming URL:  /something?a=0&foo=123&b=1
  • Redirect to:  /something?a=0&foo=bar&b=1

To implement the redirect, I’ll make use of the following:

  • {{variable}} is used to insert variables into the regular Property Manager Redirect behaviors. The variables are evaluated in real time for each incoming request.
  • {{builtin.AK_URL}} is used for built-in variables, and in this example, has the original incoming url.
  • {{user.PMUSER_URL}} is used for user-defined variables, and will have the resulting redirect location.

In the example below, I define a new Set Variable behavior that will be used to populate the PMUSER_URL variable using a regular expression (^|&|\?)foo=(?:(?!(&|$)).)* and replacement string $1foo=bar. (Note that typing in {{ in a field that supports variables will bring up a list of built-in and user defined variables to choose from.)

behaviors

For the redirect, I use the user-defined variable {{user.PMUSER_URL}}, which has the resulting redirect location.

redirect

JSON Sample

For API developers, here is the corresponding Property Manager API (PAPI) intermediate JSON snippet.

Conclusion

I hope this blog post gives you some ideas on how you can use variables in Property Manager. This is just one use case, and I encourage you to get creative with yours. Some of our customers have found this feature to be both incredibly powerful, and given them the self serviceability to solve problems on their own.

Additional Resources

The primary reference documentation for variables is in the online help. From Property Manager, click any help button and search for “Working with Variables.”

There is also a Community blog post Using Variables with Property Manager, which has a few more detailed use cases, as well as comments from other users.

For API Developers and variable support, see the Property Manager API (PAPI).

Categories: Technology

Suggested Article

LEAVE A REPLY