Roberto Medrano

Scripts running in your application will call upon APIs to provide different types and access levels of data. It’s crucial that you approach scripting with a comprehensive plan for how APIs will interact with them, and how to enable scripts to get the most out of your API, while remaining secure, and adhering to efficiency principles required for high security, performance and availability.

The script creation process is an essential piece of your API strategy. SOA Software Policy Manager ensures this flexibility through lifecycle management capabilities, run-time policies and auditing through compliance auditing and enforcement. A key element of Policy Manager is that it provides a scripts interface that allows you to define a series of utility scripts for performing commonly used tasks. You can then import and reference scripts in a Process definition using the Script Activity or in a QoS Script Policy.

In working with scripts, it’s important to first understand script creation options and tools, and then see how to add a script. This should help you get started on recognizing opportunities in your API development. We’ll take a look at how to do this in Policy Manager in this, and subsequent blogs.

Script Contexts

There are several approaches that can be used to configure your script definitions:

  • You can define a script object in the Scripts section using the Add Script function. This is useful for building a library of scripts you can reuse in your Process or QoS Script Policy definitions.
  • You can create a process, add a Script Activity and import an existing script.
  • You can create a QoS Script Policy and import an existing script.
  • If there is a portion of a pre-defined script object you would like to utilize in your local script, you can import the script object and reference functions in the imported script.

Add a Script

You add a script using the Add Script function on the Scripts Summary page.

policy manager script

You select the language you will be writing your script in (JavaScript, Jython, or Beanshell Engine), add your script content and save. In the following example, this is the first script we are creating so no scripts display in the Available Scripts section. This section represents scripts that are available to be imported.

script shot

After we save the script and create a new script, you will see the “Sample Script” in the Available Scripts section. This means it can now be reused by importing it into a new script definition.

script details

We will look at more examples of using, configuring and working with scripts in follow up blogs.

Share Button

Add a comment