API Gateway 10.11 | Using API Gateway | Policies | System-defined Stages and Policies | System Context Variables
 
System Context Variables
API Gateway provides predefined system context variables and you can declare your own custom context variables. Any context variable state defined during the inbound request processing steps is available during the outbound response processing steps. To set, get, or remove the predefined context variables, use The API for Context Variables provided in API Gateway.
The table lists the predefined system context variables that you can configure in the conditional routing policy through the API Gateway user interface.
System Context Variable Name
Description
User
The identified API Gateway user for the current request.
Inbound HTTP method
The HTTP method used by the client to send the request.
For example, GET, POST, PUT, DELETE, and PATCH.
Routing method
The HTTP method used by the routing policy when you select CUSTOM as the HTTP method.
If you do not define this context variable, then the method used is from the Inbound HTTP method.
Inbound content type
Content type of the request.
Inbound accept
Accept header in the incoming request from the client.
Inbound protocol
The protocol of the request.
For example, HTTP or HTTPS.
Inbound request URI
A partial reference to an API (for HTTP and HTTPS only). The protocol, host and port are not part of the value.
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.
Inbound IP
The Client IP address used to send the request.
Gateway hostname
API Gateway host name.
Gateway IP
API Gateway IP address.
Operation name
Operation name for SOAP APIs.
It is empty for REST API.
Native Endpoint
Retrieves the native endpoint in the incoming request from the client.
The table lists the predefined context variables that you can set or get in API Gateway using an IS service. For details, see The API for Context Variables.
Context Variable Name
Description
CONSUMER_APPLICATION
The name of the consumer application accessing the API.
INTERVAL_FAULT_COUNT
The number of service faults for the interval.
INTERVAL_SUCCESS_COUNT
The number of success counts for a given API.
INTERVAL_TOTAL_COUNT
The total number of counts for a given service.
AVG_SUCCESS_TIME
The average amount of time it took the service to complete all invocations in the current interval. This is measured from the moment API Gateway receives the request until the moment it returns the response to the caller.
Note:
By default, average response time does not include metrics for failed invocations.
FASTEST_SUCCESS_INVOKE
Minimum Response Time.
Note:
By default, Minimum Response Time does not include metrics for failed invocations.
SLOWEST_SUCCESS_INVOKE
Maximum Response Time.
Note:
By default, Maximum Response Time does not include metrics for failed invocations.
SOAP_HEADERS
Contains an array of the SOAP header elements in the request.
PROTOCOL_HEADERS
Contains a map of key-value pairs in the request, where the values are provided as strings.
SERVICE_NAME
The name of the service.
NATIVE_PROVIDER_ERROR
The reason returned by the native provider in the case where it produced a SOAP fault. This will not contain API Gateway errors such as security policy enforcement errors. This variable only contains the reason text wrapped in a SOAP fault.
Note:
When you use this variable in Conditional Error Processing message that you specify in the Response Processing step, note the following: if a request is denied due to security policy enforcement, the fault handler variable $ERROR_MESSAGE would contain a native service provider error message or other error messages that result from enforced security assertions. However, $NATIVE_PROVIDER_ERROR is null in this case.
ROUTING_ENDPOINT
API Gateway takes the ROUTING_ENDPOINT value from the message context and replaces the ${sys:dyn-Endpoint} variable in the Route Through field of dynamic routing policy configuration.