APIM 3.0 Functions
APIM 3.0 has two types of functions for creating and setting up Proxy endpoint rules: Asset functions and Request functions.
APIM 3.0 has two types of functions that are integral to creating rules and setting up Proxy endpoint rules.
Asset functions
The asset
variable allows rule instances to access data associated with the asset that is being requested.
path
Description | The path to the asset being accessed. |
Syntax | asset.path |
Example |
Expression: Result: /ExampleOrg/shared/TestTask |
Snaplex functions
load balancer
Description | The load balancer for the Snaplex JCC node or FeedMaster node.
When configuring an OAuth rule callback URL, you might want to reference the Snaplex load balancer set for your API Version or Proxy. |
Syntax |
|
Example |
Expression: Result: |
Request functions
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 | request.remoteAddr |
Example |
Expression: Result: 10.0.1.2 |
remoteUser
Description | The identifier for the user making the request as a string. |
Syntax | request.remoteUser |
Example |
Expression: Result: [email protected] |
isUserinRole()
Description | Checks if the user is in the given role. |
Syntax | request.isUserInRole(role) |
Example |
Expression: Result: true |
method
Description | The HTTP method used for this request. |
Syntax | request.method |
Example |
Expression: Result: true |
uri.path
Description | The full path of the request. |
Syntax | request.uri.path |
Example |
Expression: Result: /api/1/rest/feed/example/shared/HelloTask |
uri.query
Description | The query parameters for this request. |
Syntax | request.uri.query |
Example |
Expression: 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. CAUTION:
Since accessing this object can be error-prone, it is best to use the
match operator to extract data:
match request.headers { { “Content-Type”: [ctype] } => ctype }
|
Syntax | request.headers |
Example |
Expression: Result: ["application/json"] |
properties
Description |
An object that contains the internal properties associated with the request. When configuring an OAuth rule scope, you might want to list the Snaplexes. You can use the following functions to do so:
|
Syntax | request.properties |
Example |
Expression: Result: |
roles
Description |
An object that contains all existing roles.
[anonymous] or [admins, members]
|
Syntax | request.roles |
Example |
Expression: Result: admins, members |