API Manager Functions
- 1 Overview
- 2 Asset Functions
- 2.1 path
- 3 Snaplex Functions
- 3.1 load balancer
- 4 Request Functions
- 4.1 remoteAddr
- 4.2 remoteUser
- 4.3 isUserinRole()
- 4.4 method
- 4.5 uri.path
- 4.6 uri.query
- 4.7 headers
- 4.8 properties
- 4.9 roles
- 5 Related Content
Overview
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
Asset Functions
The asset variable allows policy instances to access data associated with the asset that is being requested.
path
Description | The path to the asset being accessed. |
---|---|
Syntax |
|
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 |
|
Example | Expression: Result: |
Request Functions
The request
variable allows Policy instances to access data associated with the current request being processed.
remoteAddr
Description | The IP address of the client making the request as a string. Note that this can be an IPv4 or IPv6 address. |
---|---|
Syntax |
|
Example | Expression: request.remoteAddr Where the request was made from the IP address 10.0.1.2 Result: 10.0.1.2 |
remoteUser
Description | The identifier for the user making the request as a string. |
---|---|
Syntax |
|
Example | Expression: request.remoteUser Where the request was made by the user Result: sally@example.com |
isUserinRole()
Description | Checks if the user is in the given role. |
---|---|
Syntax |
|
Example | Expression: request.isUserInRole('admin') Where the request was made by a user that has the admin role. Result: true |
method
Description | The HTTP method used for this request. |
---|---|
Syntax |
|
Example | Expression: request.method == 'POST' Where the request is a POST Result: true |
uri.path
Description | The full path of the request. |
---|---|
Syntax |
|
Example | Expression: request.uri.path Result: /api/1/rest/feed/example/shared/HelloTask |
uri.query
Description | The query parameters for this request. |
---|---|
Syntax |
|
Example | Expression: request.uri.query Result: $name |
headers
Description | An object that contains the headers from the request. The property names in the object correspond to the HTTP header names that were in the request and lookups are case-insensitive. The values of the properties are lists of strings where each element comes from one instance of a header. Since accessing this object can be error-prone, it is best to use the match operator to extract data, like so:
|
---|---|
Syntax |
|
Example | Expression: request.headers['Content-Type'] Where the request was made with the Content-Type header set to application/json Result: ["application/json"] |
properties
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:
|
---|---|
Syntax |
|
Example | Expression: Result: |
roles
Description | An object that contains all existing roles.
Responses: |
---|---|
Syntax |
|
Example | Expression: request.roles Result: admins, members |
Related Content
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.