Variable keyword | Description |
paramStage | Defines the stage of the system defined policy. Possible values are: request response |
paramType | Defines the specific parameter of the request or response. Possible values are: payload headers query path httpMethod statusCode statusMessage |
queryType | Defines the query that can be applied over string elements like payload. Possible values are: xpath jsonPath regex |
Variable Syntax | Description |
${request.headers.NAME} Example: ${request.headers.Content-Type} | Gets the value of the header name in the request. |
$ {request.query.NAME} Example: ${request.query.var1} | Gets the value of the query name in the request. |
${request.path} | Gets the value of the path in the request. |
${request.path.regex[EXPR]} Example: ${request.path.regex[0]} | Gets the value of the path in the request. |
${request.httpMethod} | Gets the method in the request. |
${request.payload.xpath[EXPR]} Example:${request.payload.xpath[//ns:emp/ns:empName]}, where //ns:emp/ns:empName is the xpath to be applied on the payload if contentType is application/xml | Gets the value after applying a xpath expression on the request path. Note: The namespace URI for the prefixes you have configured in the xpath expression are resolved using namespaces configured in the metadata section in the policy or using the namespaces configured through XpathNamespaces custom variable in the custom extension policy. |
${request.payload.jsonPath[EXPR]} Example: ${request.payload.jsonPath[$.cardDetails.number]} where $.cardDetails.number is the jsonPath to be applied on the payload if contentType is application/json. Provide the following variable, if there is a blank space in the parameter name ${request.payload.jsonPath[$.['param name'] ]} For example, if the parameter name is first name, then provide the variable as ${request.payload.jsonPath[$.['first name']]}. | Gets the value after applying a json expression on the request path. |
${request.payload.regex[EXPR]} Example: ${request.payload.regex[[0-9]+]} where [0-9]+ is the regex to be applied on the payload if contentType is text/plain | Gets the value after applying a regular expression on the request path. |
${request.authorization.clientId} | Gets the value of the client ID identified from the authorization header by the configured IAM policy. This value is available only if the relevant IAM policy is configured. |
${request.authorization.issuer} | Gets the value of the issuer identified from the authorization header by the configured IAM policy. This value is available only if the relevant IAM policy is configured. |
${request.authorization.userName} | Gets the value of the username identified from the authorization header by the configured IAM policy. This value is available only if the relevant IAM policy is configured. |
${request.authorization.authHeader} | Gets the value of the authorization header by the configured IAM policy. This value is available only if the relevant IAM policy is configured. Note: If the authorization header has bearer tokens ( such as OAuth, OpenID, or JWT), then you cannot use this variable. In such cases, Software AG recommends to use the ${request.authorization.incomingToken} variable. |
${request.authorization.apiKey} | Gets the value of the API key from the authorization header by the configured IAM policy. This value is available only if the relevant IAM policy is configured. |
${request.authorization.incomingToken} | Gets the value of the incoming token from the authorization header by the configured IAM policy. This value is available only if the relevant IAM policy is configured. |
${request.authorization.audience} | Gets the value of the audience from the authorization header by the configured IAM policy. This value is available only if the relevant IAM policy is configured. |
${request.authorization.claims.CLAIM_NAME} Example: ${request.authorization.claims.exp } | Gets the value for the claim name from the claims identified from the Authorization header by the configured IAM policy. This format is applicable when a JWT token is used for authorization. |
${request.correlationID} | Gets the correlation ID for this request. |
${request.application.id} | Gets the ID of the application identified for this request. |
${request.application.name} | Gets the name of the application identified for this request. |
${request.application.version} | Gets the version ID of the application identified for this request. |
${request.application.claims.CLAIM_NAME} Example:${ request.application.claims.sample } | Gets the value of the claim name for the claims identifier configured in the application identified for this request. This format is applicable when a JWT token is used for authorization. |
${request.application.partnerId} | Gets the partner ID of the application identified for this request. |
${request.application.description} | Gets the description of the application identified for this request. |
${request.application.hostname[NUMBER]} Example: ${ request.application.hostname[0]} | Gets the value of the hostname identifier in the specified index for the application identified for this request. |
${request.application.payloadIdentifier[NUMBER]} Example:${request.application.payloadIdentifier[1]} | Gets the value of the payload identifier in the specified index for the application identified for this request. |
${request.application.team[NUMBER]} Example: ${request.application.team[0]} | Gets the value of the team identifier in the specified index for the application identified for this request. |
${request.application.token[NUMBER]} Example:${request.application.token[1]} | Gets the value of the token identifier in the specified index for the application identified for this request. |
${request.application.username[NUMBER]} Example:${request.application.username[0]} | Gets the value of the username identifier in the specified index for the application identified for this request. |
${request.application.wssUsername[NUMBER]} Example:${request.application.wssUsername[0]} | Gets the value of the wssUsername identifier in the specified index for the application identified for this request. |
${request.application.headers.HEADER_NAME} Example:${request.application.headers.Accept} | Gets the value of the header name for the headers identifier configured in the application identified for this request. |
Variable Syntax | Description |
${response.headers.NAME} Example: ${response.headers.Accept} | Gets the value of the header name in the response. |
${response.statusCode} | Gets the value for the status code for the response. |
${response.statusMessage} | Gets the value for the status message in the response |
${response.payload.xpath[EXPR]} Example:${response.payload.xpath[//ns:emp/ns:empName]} where //ns:emp/ns:empName is the xpath to be applied on the payload if contentType is application/xml | Gets the value of the payload from the specified xpath of the response. Note: The namespace URI for the prefixes you have configured in the xpath expression are resolved using namespaces configured in the metadata section in the policy or using the namespaces configured through XpathNamespaces custom variable in the custom extension policy. |
${response.payload.jsonPath[EXPR]} Example:${response.payload.jsonPath[$.cardDetails.number]} where $.cardDetails.number is the jsonPath to be applied on the payload if contentType is application/json | Gets the value of the payload from the specified jsonPath of the response. |
${response.payload.regex[EXPR]} Example: ${ response.payload.regex[[0-9]+]} where [0-9]+ is the regex to be applied on the payload if contentType is text/plain | Gets the value of the payload from the specified regex of the response. |
Expressions | Response |
$.phoneNumbers[1].type | "home" |
$.phoneNumbers[0,1].type or $.phoneNumbers[:2].type | ["iPhone","home"] |
$.phoneNumbers[0,1] or $.phoneNumbers[:2] | [{"type":"iPhone","number":"0123-4567-8888"} \{"type":"home","number":"0123-4567-8910"}] |
$..firstName | ["John"] |
$.firstName | "John" |
$.address.city | "Nara" |
Variable Syntax | Description |
${apiId} | Get the value of the API ID. |
${apiName} | Get the name of the API. |
${apiVersion} | Get the version of the API. |
${packageId} | Get the value of the package ID. |
${planId} | Get the value of the plan ID. |
${customTransactionFields.FIELD_NAME} Example: ${customTransactionFields.sample} | Provides you an option to get or set custom fields to the transactional events for this request. To set the custom fields, you can configure the customTransactionFields.FIELD_NAME custom variable in Custom Extension policy. |
${providerTime} | Gets the time taken in milliseconds between the request sent to native server and response received from native server for this transaction. |
${date} | Gets the date when the request gets invoked. |
${dynamicEndpoint} | Gets the value of the ROUTING_ENDPOINT context variable set using pub.apigateway.ctxvar:setContextVariable. |
${time} | Gets the time when the request gets invoked. |
${user} | Gets the value of the user ID who sends the request. |
${inboundHttpMethod} Example: GET | Gets the value the HTTP method used by the client to send the request. |
${routingMethod} Example: POST | Gets the value of the HTTP method used by the API Gateway in the routing policy to send the request to native API. |
${InboundContentType} Example: application/json | Gets the content type of the request. |
${inboundAccept} Example: */* | Gets the accept header in the incoming request from the client. |
${inboundProtocol} | Gets the protocol of the request. |
${inboundRequestURI} For example, if the API is invoked: http://host:port/gateway/API then the expected value of this variable would be /gateway/API. For a REST API, the URL also includes query string parameters. For example, if the following API is invoked: http://host:port/gateway/cars?vin=1234 the expected value of this variable would be /gateway/cars?vin1234. | A partial reference to an API (for HTTP and HTTPS only). The protocol, host and port are not part of the value. |
${inboundIP} Example: 210.178.9.0 | Gets the value of the client IP address used to send the request. |
${gatewayHostname} Example: uk.myhost.com | Gets the API Gateway host name. |
${gatewayIP} Example: 198.168.1.9 | Gets API Gateway IP address. |
${operationName} Example: addInts | Gets the value of API operation selected from the request. Operation names are available only for SOAP APIs. It is empty for REST API. |
${nativeEndpoint} Example: http://host:port/Service | Gets the value of the native endpoints from the request. It returns value only after executing the routing policy. |