Manage Policy Templates

In the API wizard, API publishers use policy templates to customize how a policy on the API proxy processes calls to an API. API publishers commonly use authentication and quota policies to control API access. The API proxy administrator creates the policy templates.
apip42
In the API wizard, API publishers use policy templates to customize how a policy on the API proxy processes calls to an API. API publishers commonly use authentication and quota policies to control API access. The API proxy administrator creates the policy templates.
For information about how to use a policy template when publishing an API on the
API Portal
, see Manage APIs.
To add a policy template to the
API Portal
, API proxy administrators use the Policy Manager to add an encapsulated assertion to the API proxy. The API proxy administrator can add input and output arguments to the encapsulated assertion. For information about the encapsulated assertions, see the topic "Encapsulated Assertions" in the online documentation for the CA API Gateway.
IMPORTANT:
  • We strongly recommend that only API proxy administrators with experience developing policies on the API Gateway should create policy templates.
  • To create modular policy templates that API publishers can combine is challenging, so keep them simple.
  • Policy templates are available only to APIs published on the
    API Portal
    .
  • Each template needs at least one input argument that is displayed in the 
    API Portal
To create a policy template:
  1. In the Policy Manager, connect to the API proxy.
  2. On the Tasks menu, select
    Create Policy
    . In the Policy Properties dialog, enter a name and select
    OK
    . The policy fragment appears on the Policy Manager Services and Policies list and Policy Development window.
  3. Open the Internal Assertions palette and drag a 
    Set as Portal Publishable Fragment
     to the policy fragment in the Policy Development window.
  4. In the Policy Development window, construct the policy.
  5. In the Services and Policies list, right-click the policy fragment and select
    Create Encapsulated Assertion
    . Confirm the auto-population of inputs and outputs. The Encapsulated Assertion Configuration Properties dialog opens.
  6. Enter a template name and a description. On the
    Palette Folder
    menu, select a palette.
    Note:
    The
    API Portal
     displays the name and description. Ensure that the description clearly describes to API publishers how they can use the template alone or with other templates.
  7. Add input and output arguments. Do not include periods in the names of input arguments, such as "test.email".
    To display an input argument, assign the string, integer, decimal, or Boolean type to the argument, and select the check box next to the 
    Show in assertion properties dialog
    .
    To make a displayed input argument mandatory, add an asterisk to the end of the input argument label.
  8. Select
    OK
    . The dialog closes.
  9. Select
    Save and Activate
    .
To verify that the new policy template is in the
API Portal
:
  1. Log in to the
    API Portal
    as an 
    API Portal
     administrator.
  2. Select 
    Publish
    .
  3. On the APIs page, select
    Add API
  4. On the
    API Details
    tab, enter an API name and version, select a EULA, and select
    Next
    .
  5. On the
    Proxy Configuration
    tab, open the
    Policy Template
    menu. Verify that the menu includes the new policy template. Also verify that the template displays any fields that were configured to appear.
To edit a policy template:
  1. In the Policy Manager, log in to the API proxy.
  2. To edit the template policy:
    1. Open the policy in the Policy Development window.
    2. Edit the policy.
    3. Select 
      Save and Activate
      .
  3. To edit the template's encapsulated assertion:
    1. Open the encapsulated assertion in the Encapsulated Assertions Property dialog.
    2. Optional:
       Edit the name and description of the encapsulated assertion.
    3. Optional:
       Add, edit, or delete arguments. 
      Note:
      Do not include periods in the names of input arguments, such as "test.email".
To delete a policy template:
  1. In the Policy Manager, log in to the API proxy.
  2. On the Tasks menu, select 
    Manage Encapsulated Assertions
    . The Manage Encapsulated Assertion Configurations dialog opens.
  3. Select the template's encapsulated assertion and select 
    Remove
    . Close the dialog.
  4. In the Policy Manager's Services and Policies list, right-click the policy fragment and select 
    Delete Policy
    .
  5. Use the preceding policy template verification procedure to confirm that the deleted template does not appear in the
    API Portal
    .