Get started with KPS

Develop an example KPS table for managing simple user information.

4 minute read

The final structure of the example KPS table in Policy Studio is as follows:

Getting Started - User table in Policy Studio

This table structure is described as follows:

Column Type Description
age java.lang.Integer User age.
email java.lang.String User email address. This is selected in Policy Studio as a unique Primary Key, which is indexed implicitly by default.
firstName java.lang.String User first name.
lastName java.lang.String User surname.
password java.lang.String User password, which is selected as Encrypted in Policy Studio.

Example table data is displayed on the SettingsKey Property Stores tab in the API Gateway Manager web console:

Getting Started - sample User data in KPS browser

Before you begin

The following prerequisite steps apply to this example:

  1. Ensure that an API Gateway and an Admin Node Manager are running.
  2. Start Policy Studio, and connect to the Admin Node Manager.

Define KPS configuration with Policy Studio

The main steps for configuring KPS tables in Policy Studio are as follows:

Step 1: Define where data will be stored

You must first create a KPS collection in which to store the KPS table configuration. Perform the following steps:

  1. In the Policy Studio tree, select Environment Configuration > Key Property Stores, then select Add KPS Collection.

    KPS collection with the default Embedded (Cassandra) data source

  2. In the Add KPS Collection dialog, enter a name to the collection, for example Samples, and select Cassandra from the Default data source list.

    Leave the Alias prefix field blank.

Step 2: Define the KPS table

To create a table, perform the following steps:

  1. In the Policy Studio tree, right-click the newly-created Samples collection, and select Add Table:

    Add Table menu option

  2. In the dialog, enter a Name (for example, User) and provide a Description.

  3. Click Add to assign an alias of User to this table. A table must have at least one alias.

  4. Next define the table structure. This consists of the table columns and the data type stored in each column. Select the User table and Structure tab, and click Add:

    KPS table configuration - specify table structure

  5. Repeat to add the following columns for your table structure in the Add Property dialog:

    • email
    • password
    • firstName
    • lastName
    • age

    age has an Integer (numeric) Type. All the other columns are String. For more details, see KPS table structure.

  6. When you select the User table, you should have the following structure:

    Column structure of the User KPS table

  7. You want the email field to be the primary key for the table, so select Primary Key for this field.

    Set the email column to be a primary key

  8. You want the password field to be encrypted when stored in the data source, so select Encrypted for this field.

    Set the password column to be encrypted

Step 3: Define a policy that accesses the table

To define a test policy that accesses the table, perform the following steps:

  1. Add a test policy with a Set Message filter from the Conversion filter category.

    Test policy to access the table

  2. Right-click the filter and set it as the Start filter for the policy.

  3. Enter a filter Content-Type of text/plain.

  4. Enter the following Message Body for use in the policy:

    Email: ${kps.User[].email}
    First Name: ${kps.User[].firstName}
    Last Name: ${kps.User[].lastName}
    Age: ${kps.User[].age}
  5. Set up a path to this policy. In this example, the path is /kpsGetViaSelector:

Create a path to the test policy

Step 4: Deploy the configuration

When you are finished with your configuration changes, you must deploy them to the API Gateway. To deploy the new configuration, click Deploy in the Policy Studio toolbar:

Deploy the configuration

This pushes the configuration to the API Gateway group.

Add KPS data using API Gateway Manager

You can use API Gateway Manager to populate the User table with data.

For example, perform the following steps:

  1. To access API Gateway Manager in your browser, go to https://localhost:8090.
  2. Select the Settings > Key Property StoresSamplesUser table.
  3. To enter new records, select ActionsNew Entry on the right.
  4. Click Save to save a record.

For example, the table should look as follows:

KPS browser showing sample record

Access KPS data from a policy

To access KPS data from a policy, go to the following URL in your browser:


This URL specifies the user ID (email) as

You must specify an email that exists in your data. For example:

Sample policy execution

Sample policy execution - unknown primary key (email)

Enable API Gateway tracing

To enable API Gateway debug tracing, perform the following steps in Policy Studio:

  1. In the tree on the left, select Environment Configuration > Server Settings > General.
  2. Select a Tracing level of DEBUG.
  3. Click Save.
  4. Click Deploy.

Enable debug tracing