Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
maxLevel3

...

The API Policy Manager has two types of functions that are integral to creating policies and setting up Proxy endpoint rules.

  • Asset Functions

  • Request Functions

...

The asset variable allows Policy policy instances to access data associated with the asset that is being requested.

...

Description

The path to the asset being accessed.

Syntax

asset.path

Example

Expression: asset.path

Where the request was for a Task in the organization’s shared project. 

Result: /ExampleOrg/shared/TestTask

Snaplex Functions

load balancer

Description

The load balancer for the Snaplex JCC node or FeedMaster node.

When configuring an OAuth policy callback URL, you might want to reference the Snaplex load balancer set for your API Version or Proxy.

Syntax

  • jccLoadbalancer

  • snaplex.feedMasterLoadbalancer

Example

Expression:

Result: 

Request Functions

The request variable allows Policy instances to access data associated with the current request being processed.

...

Description

The identifier for the user making the request as a string.

Syntax

request.remoteUser

Example

Expression: request.remoteUser

Where the request was made by the user “sally@http://examplesally@example.com ”.:

Result: sally@example.com

isUserinRole()

Description

Checks if the user is in the given role.

Syntax

request.isUserInRole(role)

Example

Expression: request.isUserInRole('admin')

Where the request was made by a user that has the admin role.

Result: true

...

Description

The HTTP method used for this request.

Syntax

request.method

Example

Expression: request.method == 'POST'

Where the request is a POST

Result: true

...

Description

The full path of the request.

Syntax

request.uri.path

Example

Expression: request.uri.path

Result: /api/1/rest/feed/example/shared/HelloTask

...

Description

The query parameters for this request.

Syntax

request.uri.query

Example

Expression: request.uri.query

Result: $name

...

Description

An object that contains the internal properties associated with the request.

When configuring an OAuth policy scope, you might want to list the Snaplexes. You can use the following functions to do so:

  • For JCC node in a Snaplex: snaplex.jccLoadbalancer

  • For the FeedMaster node in a Snaplex: snaplex.feedMasterLoadbalancer

Syntax

request.properties

Example

Expression:

Result: 

...