Overview

Variable is a structure used for finding the data that the policy needs from the message in the API traffic. It is used to extract data from different parts of HTTP requests (header, parameter, body, etc.). See Variable


Key Features

Feature

Type

Required

Description

nameStringYesUnique name of the variable
descriptionStringNoDescription for the variable
typeEnumVariableTypeYesType of variable (HEADER, PARAMETER, BODY, CONTEXT_VALUES, CUSTOM)

Variable Types and Required Fields


type Value

Purpose of Use

Field

Description

Required

HEADERUsed to extract data from the headerheaderNameThe name of the Http Header field in the request or response messageYes
BODYUsed to extract data from the request/response bodytargetContentTypeContent type (XML, JSON, ALL_BODY)Yes
CONTEXT_VALUESUsed to extract data from system context valuescontextValueContext value typeYes
PARAMETERUsed to extract data from URL parametersparamTypeParameter type (QUERY, PATH)Yes


paramNameName of the path parameter in the request messageYes


paramPathTemplate path to use for the “path” parameter in the request messageRequired if paramType=PATH


xpathValueXPath expression for XML in the body data in the request or response messageRequired for XML


jsonPathValueJsonPath expression for JSON in the body data in the request or response messageRequired for JSON


zoneId

Time zone

Required for some context values

contextValue Values

Request Related Values

Context Value

Description

REQUEST_REMOTE_ADDRESSIP address of the client
REQUEST_HTTP_METHODHTTP method (GET, POST, etc.)
REQUEST_CONTENT_TYPERequest content type
REQUEST_PATH_INFORequest path information
REQUEST_CONTEXT_PATHContext path information
REQUEST_QUERY_STRINGURL query string parameters
REQUEST_REMOTE_USERRemote user information
REQUEST_USERNAME_KEYUsername or key
REQUEST_REQUESTED_SESSION_IDSession ID
REQUEST_REQUEST_URIRequest URI
REQUEST_CHARACTER_ENCODINGCharacter encoding
REQUEST_CHARSETCharset information
REQUEST_CONTENT_LENGTHContent length
REQUEST_PROTOCOLProtocol used
REQUEST_SCHEMEProtocol scheme (http, https)
REQUEST_SERVER_NAMEServer name
REQUEST_SERVER_PORTServer port number
REQUEST_REMOTE_HOSTRemote host information
REQUEST_REMOTE_PORTRemote port number
REQUEST_LOCAL_NAMELocal server name
REQUEST_LOCAL_ADDRLocal IP address
REQUEST_LOCAL_PORTLocal port number
REQUEST_XFORWARDED_FORX-Forwarded-For header value

Request Status Information

Context Value

Description

REQUEST_IS_SOAP_TO_RESTSOAP to REST transformation status
REQUEST_IS_APIPROXYAPI Proxy control
REQUEST_IS_APIPROXYGROUPAPI Proxy Group control
REQUEST_IS_XWWW_FORM_URL_ENCODEDForm URL encoded format check
REQUEST_IS_FORM_DATAForm data format control
REQUEST_IS_BYTE_ARRAYByte array format check
REQUEST_HAS_ATTACHMENTAdditional file check
REQUEST_GZIPGZIP compression status
REQUEST_DEFLATEDEFLATE compression state
REQUEST_HTTP_SERVLETHTTP Servlet information

Response Related Values

Context Value

Description

RESPONSE_IS_BYTE_ARRAYWhether the response is in byte array format
RESPONSE_GZIPGZIP compression status
RESPONSE_DEFLATEDEFLATE compression state
RESPONSE_BRBrotli compression state
RESPONSE_STATUS_CODEHTTP status code
RESPONSE_HTTP_SERVLETHTTP Servlet information

Message Related Values

Context Value

Description

MESSAGE_CORRELATION_IDMessage correlation ID

Environment Related Values

Context Value

Açıklama

ENVIRONMENT_IDEnvironment ID
ENVIRONMENT_NAMEEnvironment Name
ENVIRONMENT_CERTIFICATECertificate map
ENVIRONMENT_PRIVATEKEYCustom key map
ENVIRONMENT_PUBLICKEYPublic key map
ENVIRONMENT_SECRETKEYSecret key map
ENVIRONMENT_KEYSTOREKeystore map
ENVIRONMENT_JWKJWK map

API Proxy Group/Proxy/Method Values

Context Value

Description

APIPROXYGROUP_IDAPI Proxy Group ID
APIPROXYGROUP_NAMEAPI Proxy Group name
APIPROXY_IDAPI Proxy Group ID
APIPROXY_NAMEAPI Proxy Group name
APIMETHOD_IDAPI Proxy Group ID
APIMETHOD_NAMEAPI Proxy Group name
APIMETHOD_SOAP_ACTIONSOAP action value
APIMETHOD_HTTPMETHODHTTP method
APIMETHOD_ENDPOINTEndpoint information
APIMETHOD_BACKEND_HTTPMETHODBackend HTTP method
APIMETHOD_BACKEND_ENDPOINTBackend endpoint information

Values Related to History/Time

Context Value

Description

DATETIME_YEARYear
DATETIME_MONTHMonth
DATETIME_DAY_OF_WEEKDay of the week
DATETIME_DAY_OF_MONTHDay of the month
DATETIME_HOURHour
DATETIME_MINUTEMinute
DATETIME_SECONDSeconda
DATETIME_EPOCH_MILLISEpoch millisecond
DATETIME_FORMATTED_TEXTFormatted date-time
DATE_FORMATTED_TEXTFormatted date
TIME_FORMATTED_TEXTFormatted hour

Identity Information

Context Value

Description

CREDENTIAL_USERNAMEUsername
CREDENTIAL_EMAILEmail address
CREDENTIAL_FULLNAMEFull name
CREDENTIAL_SECRETKEYSecret key
CREDENTIAL_CERTIFICATECertificate
CREDENTIAL_PUBLICKEYPublic key
CREDENTIAL_PRIVATEKEYPrivate key
CREDENTIAL_KEYSTOREKeystore
CREDENTIAL_TRUSTSTORETruststore
CREDENTIAL_JWK_SIGNANDVALIDATIONJWK for signing and verification
CREDENTIAL_JWK_ENCRYPTIONANDDECRYPTIONJWK for encryption and decryption

Example JSON Structures

1. Header Value

{
  "name" : "apiKeyVariable",
  "description" : "Extracts the API key from the header",
  "type" : "HEADER",
  "headerName" : "X-API-Key"
}

2. Query Parameter Variable

{
  "name" : "userIdFromQuery",
  "description" : "Gets the user ID from the query parameter",
  "type" : "PARAMETER",
  "paramType" : "QUERY",
  "paramName" : "userId"
}

3. Path Parameter Variable

{
  "name" : "orderIdFromPath",
  "description" : "Gets order ID from path",
  "type" : "PARAMETER",
  "paramType" : "PATH",
  "paramName" : "orderId",
  "paramPath" : "/orders/{orderId}"
}

4. XML Body Variable

{
  "name" : "customerNameFromXml",
  "description" : "Extracts the customer name from the XML body",
  "type" : "BODY",
  "targetContentType" : "XML",
  "xpathValue" : "//customer/firstName"
}

5. JSON Body Variable

{
  "name" : "emailFromJson",
  "description" : "Extracts email address from JSON body",
  "type" : "BODY",
  "targetContentType" : "JSON",
  "jsonPathValue" : "$.user.contact.email"
}

6. Context Variable

{
  "name" : "Request Time",
  "description" : "Retrieves request time from system context",
  "type" : "CONTEXT_VALUES",
  "contextValue" : "DATETIME_EPOCH_MILLIS",
  "zoneId" : "Europe/Istanbul"
}