Contents

Popular

Context Variables provide a way to store temporary data inside a flow and then use it in the subsequent parts of the flow.

For example, a third party service can be called using the Service Call Out policy and the response is parsed using Assign Variables policy to define the context variables which can then be used inside a Build Message policy to populate the request payload to the target service or response to the client. 

Context variables are also populated by policies like Lookup Cache or inside custom policies like Java Call Out.

The context variables that are handled by the API gateway server are as described in the list.

Context VariableVariable ReferenceDescription
 
API Product/Developer variables
API PRODUCT NAMEapi.product.nameThe name of the product to which the client making the request is subscribed to. This variable will be populated only if the project is secured using API keys or OAuth 2.0 access tokens.
API CONSUMER KEYapi.consumer.keyThe Key corresponding to the client making the request. This variable will be populated only if the project is secured using API keys or OAuth 2.0 access tokens.
API PRODUCT QUOTA ALLOWEDapi.product.quota.allowedThe quota for the product to which the client making the request is subscribed to. This variable will be populated only if the project is secured using API keys or OAuth 2.0 access tokens. It is used in Quota policy when Enforce Quota is applied while creating a project.
API QUOTA WEIGHTapi.quota.weightThe weight of the request can be assigned using this Context Variable and then it can be used in Quota policy when Enforce Quota is applied while creating a project.
API DEVELOPER IDapi.developer.idThe ID of the consumer making the request. This variable will be populated only if the project is secured using API keys  or OAuth 2.0  access tokens.
Proxy Path variables
PROXY RESOURCE PATHproxy.resource.pathThe path of the resource which is invoked. For example, if a resource base path is items/{itemId} and a request has path items/myItem/price, then this variable will have value as items/myItem/price
PROXY RESOURCE BASE PATHproxy.resource.base.pathThe base path of the resource. For example, if a resource base path is items/{itemId} and a request has path items/myItem/price, then this variable will have value as items/myItem
PROXY RESOURCE FORWARD PATHproxy.resource.forward.pathThe path in the request after the resource base path. This path will be forwarded in the target request as well. For example, if a resource base path is items/{itemId} and a request has path items/myItem/response.json, then this variable will have value as /response.json and this will be appended to the path specified in the target for this resource.
Proxy Request variables
PROXY REQUEST SIZEproxy.request.sizeThe size of the request received from the client.
PROXY REQUEST HEADER PROPERTY PREFIXproxy.request.header.Any request header sent by the client can be retrieved inside a flow to define conditions or to evaluate them using this variable.
PROXY REQUEST QUERY PROPERTY PREFIXproxy.request.query.Any request parameter sent by the client can be retrieved inside a flow to define conditions or to evaluate them using this variable.
PROXY REQUEST FORM PROPERTY PREFIXproxy.request.form.Any form parameter sent by the client can be retrieved inside a flow to define conditions or to evaluate them using this variable.
PROXY REQUEST PATH PROPERTY PREFIXproxy.request.template.Any template parameter sent by the client can be retrieved inside a flow to define conditions or to evaluate them using this variable. For example, for a resource with resource path as items/{itemId}, the itemId that has been sent in the request can be retrieved using the variable proxy.request.template.itemId
PROXY REQUEST HTTP SCHEMEproxy.request.http.schemeThe scheme used by the client. Can be HTTP, HTTPS etc.
PROXY REQUEST PATH INFOproxy.project.path.infoThe path at which the request has been received by the proxy. This includes the base path of the project.
PROXY REQUEST HTTP VERSIONproxy.request.http.versionThe HTTP version of the request received from the client, can be 1.0, 1.1 etc.
PROXY REQUEST METHODproxy.request.methodThe method that is invoked on the resource by the client such as GET, POST, PUT, and DELETE.
PROXY REQUEST IN TIMEproxy.request.in.timeThe time at which the request in received. This is the number of milliseconds, between the current time and midnight, January 1, 1970 UTC.
Target Request variables
TARGET REQUEST IN TIMEtarget.request.in.timeThe time at which the request has been sent to the target server.
TARGET REQUEST HEADER PROPERTY PREFIXtarget.request.header.Headers which have to be sent as part of the request to the target server can be populated using this prefix. The variables can be defined using the Assign Variable policy. For example, to define a header to the client such as Accept, a variable target.request.header.Accept can be defined.
TARGET REQUEST QUERY PROPERTY PREFIXtarget.request.query.Query Parameters which have to be sent as part of the request to the target server can be populated using this prefix. The variables can be defined using the Assign Variable policy. For example, to define a Query Parameter to the client such as address, a variable target.request.query.address can be defined.
TARGET REQUEST FORM PROPERTY PREFIXtarget.request.form.Form Parameters which have to be sent as part of the request to the target server can be populated using this prefix. The variables can be defined using the Assign Variable policy. For example, to define a Form Parameter to be sent to the target server from the client such as address, a variable target.request.form.address can be defined.
TARGET REQUEST PATHtarget.request.pathThe path at which the request has to be sent to the target server can be modified based on the condition of the flow using this Context Variable.
TARGET REQUEST METHODtarget.request.methodThe path which needs to be invoked on the target server can be modified based on the condition of the flow using this Context Variable.
TARGET REQUEST PROTOCOL VERSIONtarget.request.versionThe HTTP version with which the request has to be sent to the target server can be modified based on the condition of the flow using this Context Variable.
TARGET REQUEST PROTOCOLtarget.request.protocolThe HTTP protocol with which the request has to be sent to the target server can be modified based on the condition of the flow using this Context Variable.
Target Response variables
TARGET RESPONSE HEADER PROPERTY PREFIXtarget.response.header.Any response header sent by the target server can be retrieved inside a flow to define conditions or to evaluate them using this variable.
TARGET RESPONSE FORM PROPERTY PREFIXtarget.response.form.Any form parameter sent by the target server in its response can be retrieved inside a flow to define conditions or to evaluate them using this variable.
TARGET RESPONSE REASON PHRASEtarget.response.reason.phraseThe reason phrase received from the target server in case of errors.
TARGET RESPONSE STATUS CODEtarget.response.status.codeThe status code received from the target server.
TARGET RESPONSE OUT TIMEtarget.response.out.timeThe time at which the response is received from the target server.
Proxy Response variables
PROXY RESPONSE FORM PROPERTY PREFIXproxy.response.form.Form Parameters which have to be sent as a response to the client can be populated using this prefix. The variables can be defined using the Assign Variable policy.
PROXY RESPONSE HEADER PROPERTY PREFIXproxy.response.header.Headers which have to be sent as a response to the client can be populated using this prefix. The variables can be defined using the Assign Variables policy. For example, to define a response header to the client such as Content-Type, a variable proxy.response.header.Content-Type can be defined.
PROXY RESPONSE OUT TIMEproxy.response.out.timeThe time in milliseconds at which the response is sent back to the client.
PROXY RESPONSE SIZEproxy.response.sizeThe size of response sent back to the client.
API Project variables
API PROJECT IDapi.project.nameThe name of the project. This variable is used for analytics.
API PROJECT VERSIONapi.project.versionThe version of the project.
API PROJECT CONTEXT PATHapi.project.context.pathThe base path of the API project. This is used for analytics.
Client Variables
CLIENT IPclient.ipThe IP Address of the client making the request.
CLIENT HOST NAMEclient.hostnameThe host name of the client making the request.
CLIENT REQUEST PORTclient.portThe port at which the client is sending the request.
Streaming variables
REQUEST STREAMING ENABLEDrequest.streaming.enabledThe variable provides information if streaming is enabled while sending a request to the target server.
RESPONSE STREAMING ENABLEDresponse.streaming.enabledThe variable provides information if streaming is enabled while sending response from the target server to the client.
Cache variables
RESPONSE CACHE NAMEresponse.cache.nameThe cache into which the response is cached when Response Cache policy is being used.
CACHE HITcache.hitThe variable which determines if the cache has been hit.
Target Fail over variables
TARGET FAILOVER OCCURREDtarget.failover.occurredThe variable which identifies if a target fail over has occurred.
TARGET FAILOVER FROMtarget.failover.fromThe ID of the target configuration from which the fail over occurred.
TARGET FAILOVER TOtarget.failover.toThe ID of the target configuration to which the fail over has occurred.
Environment variables
ENVIRONMENT NAMEenvironment.nameThe name of the environment through which this request is passing.
Adaptavist ThemeBuilder EngineAtlassian Confluence