Skip to Content

In this Blog,I will walk you through “predefined variable” provided by SAP Cloud Platform, API Management.

SAP Cloud Platform, API Management describes a set of variables predefined by the API Services. Types of variables available are:

  • Request Message Variables
  • System Variables
  • Response Message Variables
  • Message Variables
  • Error Variables
  • Configuration Variables
  • Path Variables
  • API Proxy Flows Variables
  • TSL/SSL Variables

Request Message Variables

Request message variables are used in policies to access message components like the header, the query parameters, form parameters, the source IP address, the HTTP message body. API proxy applies the incoming request to a series of policies, depending on the request condition, API proxy can either modify or transform the request. Based on the content of the request variable, policies can either transform or reject the request. Supported request variables are listed in the Request Message Variables table.

Variable

 

 Description

 

 

client.host

 

Scope:Proxy request

Type: String

Permission: Read

The HTTP host IP associated with the request received by the ProxyEndpoint.

 

client.ip

 

Scope:Proxy request

Proxy request type: String

Type: String

Permission: Read

The IP address of the client or system sending the message to the Edge Router. For example, this could be the original client IP or a load balancer IP.

 

client.port

 

Scope:Proxy request

Type: IntegerPermission: Read

Permission: Read

The HTTP port associated with the originating client request to ProxyEndpoint.

 

client.received.end.time

 

Scope:Proxy request type: String

Type: String

Permission: Read

The time, expressed in string form, at which the proxy finished receiving the request from the originating client at the ProxyEndpoint. For example Wed, 21 Aug 2013 19:16:47 UTC

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

client.received.end.timestamp

 

Scope:Proxy request

Type: Long

Permission: Read

The timestamp value specifying when the proxy finished receiving the request from the originating client at the ProxyEndpoint. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970, TC.

 

client.received.start.time

 

Scope:Proxy request

Type: String

Permission: Read

The time, expressed in string form, at which the proxy began receiving the request from the originating client at the ProxyEndpoint. For example Wed, 21 Aug 2013 19:16:47 UTC

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

client.received.start.timestamp

 

Scope: Proxy request

Type: Long

Permission: Read

The timestamp value specifying when the proxy began receiving the request from the originating client at the ProxyEndpoint. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970, UTC.

 

client.sent.end.time

 

Scope: Proxy response

Type: String

Permission: Read

The time, expressed in string form when the ProxyEndpoint finished returning the response to the originating client app. For example Wed, 21 Aug 2013 19:16:47 UTC

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

client.sent.end.timestamp

 

Scope: Proxy response

Type: Long

Permission: Read

The timestamp value specifying when the ProxyEndpoint finished returning the response to the originating client app. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970, UTC.

 

client.sent.start.time

 

Scope: Proxy response

Type: String

Permission: Read

The time, expressed in string form, when the ProxyEndpoint started returning the response to the originating client app. For example: Wed, 21 Aug 2013 19:16:47 UTC

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

client.sent.start.timestamp

 

Scope: Proxy response

Type: Long

Permission: Read

The timestamp value specifying when the ProxyEndpoint started returning the response to the originating client app. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970 UTC.

 

client.scheme

 

Scope: Proxy request

Type: String

Permission: Read

Returns http or https depending on the transport used by client app to send the request message.

 

message.queryparam.{queryparam_name}

 

Scope: Proxy request

Type: String

Permission: Read

Returns the specified message query parameter.

 

message.queryparam.{queryparam_name}.values.count

 

Scope: Proxy request

Type: Integer

Permission: Read

The total count of a specified query parameter associated with the request sent to the ProxyEndpoint from the client app

 

message.queryparams.count

 

Scope: Proxy request

Type: Integer

Permission: Read

The total count of all query parameters associated with the request sent to the ProxyEndpoint from the client app.

 

message.queryparams.names

 

Scope: Proxy request

Type: Collection (JavaObject)

Permission: Read

A list of all query parameter names associated with the request sent to the ProxyEndpoint from the client app.

 

message.querystring

 

Scope: Proxy request

Type: String

Permission: Read

A string containing all query parameter names and values associated with the request sent to the ProxyEndpoint from the client app.

 

message.uri

 

Scope: Proxy request

Type: String

Permission: Read

The complete URI path (following the domain URL) including query parameters.

 

message.verb

 

Scope: Proxy request

Type: String

Permission: Read

The HTTP verb (GET, PUT, POST, DELETE, etc.) associated with the request

 

message.version

 

Scope: Proxy request

Type: String

Permission: Read/Write

The HTTP version associated with the request sent to the ProxyEndpoint from the client app.

 

messageid

 

Scope: Proxy request

Type: String

Permission: Read

Holds the globally unique ID for the request, which includes the router host name. This ID allows requests received at the router to be tracked after they are sent to the message processor.

This ID is logged in Edge error logs to correlate the message Id with the errors.

 

proxy.basepath

 

Scope: Proxy request

Type: String

Permission: Read

The value of the Base Path in your API proxy configuration. The base path is the URI fragment that follows the host in the URL. Conditional flow URIs follow the base path.

 

proxy.client.ip

 

Scope: Proxy request

Type: String

Permission: Read

The IP address of the original requestor, such as the client.

 

proxy.pathsuffix

 

Scope: Proxy request

Type: String

Permission: Read

The value of API proxy base path suffix that is sent from the client and received at the ProxyEndpoint.

The basepath is defined as the path component that uniquely identifies the API proxy. The public-facing URL of an API proxy is comprised of your organization name, the environment where the proxy is deployed, the base path, the base path suffix, and any query parameters.

For example, in the following request:

http://myorg-test.sap.net/v2/weatherapi/forecastrss?w=12797282

The base path suffix is /forecastrss

 

proxy.url

 

Scope: Proxy request

Type: String

Permission: Read

Gets the complete URL associated with the proxy request received by the ProxyEndpoint, including any query parameters present. Note that the host in proxy.url is the router host, not the host used in the original request.

 

request

 

Scope: Proxy request

Type: Message

Permission: Read

The complete request, including any payload present.

 

request.content

 

Scope: Proxy request

Type: String

Permission: Read/Write

Gets or sets the payload of the request message.

 

request.formparam.{formparam_name}

 

Scope: Proxy request

Type: String

Permission: Read/Write

Gets or sets the value of the specified form parameter in the request sent from the client app.

 

request.formparam.{formparam_name}.

 

values.count

 

Scope: Proxy request

Type: Integer

Permission: Read

Count of all values for the specified form parameter associated with the request.

 

request.formparams.count

 

Scope: Proxy request

Type: Integer

Permission: Read

Count of all form parameters associated with the request sent from the client app.

 

request.formparams.names

 

Scope: Proxy request

Type: Collection

Permission: Read

A list of all form parameter names associated with the request.

 

request.header.{header_name}

 

Scope: Proxy request

Type: String

Permission: Read/Write

Gets or sets the value of a particular header found in the request.

 

request.header.{header_name}.values

 

Scope: Proxy request

Type: Collection

Permission: Read

All the values of a particular header in the request

 

request.header.{header_name}.values.count

 

Scope: Proxy request

Type: Integer

Permission: Read

Count of all the values of a particular header in the request.

 

request.headers.count

 

Scope: Proxy request

Type: Integer

Permission: Read

Count of all the headers in the request.

 

request.path

 

Scope: Proxy request

Type: String

Permission: Read

The un-proxied resource path (not including the host) to the backend service, excluding query parameters.

 

request.queryparam.{queryparam_name}

 

Scope: Proxy request

Type: String

Permission: Read/Write

The value of a particular query parameter found in the request.

 

request.queryparam.{queryparam_name}.

 

Scope: Proxy request

Proxy request

Type: Integer

Permission: Read

The count of all the values of a particular query parameter in the request.

 

request.queryparams.count

 

Scope: Proxy request

Type: Integer

Permission: Read

The count of all the query parameters in the request.

 

request.queryparams.names

 

Scope: Proxy request

Type: Collection (JavaObject)

Permission: Read

The names of all the query parameters in the request.

 

request.querystring

 

Scope: Proxy request

Type: String

Permission: Read

The complete list of query parameters in the request sent from the client app.

For example, if the request is

http://host.com/123?name=first&surname=second&place=address

then this variable returns

name=first&surname=second&place=address

 

request.transportid

 

Scope: Proxy request

Type: String

Permission: Read

ID of the request as type TransportMessage which is a contextual object

 

request.transport.message

 

Scope: Proxy request

Type: Transport Message

Permission: Read

Request of type TransportMessage which is a contextual object

 

request.uri

 

Scope: Proxy request (differs in the response)

Type: String

Permission: Read

In an API proxy, the proxy <BasePath> in the ProxyEndpoint (in addition to the proxy’s base URL) maps to the target service URL in the TargetEndpoint. For example:

<ProxyEndpoint>

<BasePath>/my-mock-proxy</BasePath>

points to

<TargetEndpoint>

<HTTPTargetConnection>

http://mocktarget.sap.com

</HTTPTargetConnection>

In the request, the request.uri is the proxy base path + the remainder of the address, including query parameters.

In the response, the request.uri is the remainder of the address, including query parameters, after the HTTPTargetConnection.

The difference is because the original request came into the proxy, but then the proxy makes another request to the target service.

Let’s say the following call is made to our sample proxy, which has a base path of /my-mock-proxy:

http://my_org-test.sap.com/my-mock-proxy/user?user=test

and the proxy calls

http://mocktarget.apigee.net (which appends /user?user=test to that URL).

Request: request.uri = /my-mock-proxy/user?user=test

Response: request.uri = /user?user=test

 

request.url

 

Scope: Target request

Type: String

Permission: Read

Returns the exact complete URL of the final request made.

 

request.verb

 

Scope: Proxy request

Type: String

Permission: Read

The HTTP verb used for the request. For example: GET, PUT, DELETE

 

request.version

 

Scope: Proxy request

Type: String

Permission: Read

Gets the HTTP version of the request.

 

response.formstring

 

Scope: Target request

Type: String

Permission: Read

The complete list of form parameters in the request.

For example: name=test&type=first&group=A

 

route.name

 

Scope: Target request

Type: String

Permission: Read

The name of the RouteRule that was executed in the ProxyEndpoint. For example default. A RouteRule reference an API proxy TargetEndpoint to execute.

 

route.target

 

Scope: Target request

Type: String

Permission: Read

The name of the TargetEndpoint that was executed. For example fault.

 

servicecallout.requesturi

 

Scope: Proxy request

Type: String

Permission: Read/Write

The TargetEndpoint URI for a ServiceCallout policy. The URI is the TargetEndpoint URL without the protocol and domain specification.

 

servicecallout.{policy-name}.expectedcn

 

Scope: Proxy request

Type: String

Permission: Read/Write

The expected Common Name of the TargetEndpoint as referred to in a ServiceCallout policy. This is meaningful only when the TargetEndpoint refers to an TLS/SSL endpoint.

 

servicecallout.{policy-name}.target.url

 

Scope: Proxy request

Type: String

Permission: Read/Write

The TargetEndpoint URL for a particular ServiceCallout policy.

 

target.basepath

 

Scope: Target request

Type: String

Permission: Read

Returns basepath of TargetEndpoint

 

target.copy.pathsuffix

 

Scope: Target request

Type: Boolean

Permission: Read/Write

When true, request forwarded from ProxyEndpoint to TargetEndpoint retains path suffix (the URI path fragment following the URI defined in the ProxyEndpoint base path.)

 

target.copy.queryparams

 

Scope: Target request

Type: Boolean

Permission: Read/Write

When true, request forwarded from ProxyEndpoint to TargetEndpoint retains query parameters.

 

target.cn

 

Scope: Target request

Type: String

Permission: Read

The Common Name of the TargetEndpoint. This is meaningful only when the TargetEndpoint refers to an TLS/SSL endpoint.

 

target.expectedcn

 

Scope: Proxy request

Type: String

Permission: Read/Write

The expected Common Name of the TargetEndpoint. This is meaningful only when the TargetEndpoint refers to an TLS/SSL endpoint.

 

target.name

 

Scope: Target request

Type: String

Permission: Read

Target to which message is reaching from targetendpoint

 

target.sent.end.time

 

Scope: Target request

Type: String

Permission: Read

The time, expressed in string form, at which the proxy stopped sending the request to the URL specified in the TargetEndpoint. For example: Wed, 21 Aug 2013 19:16:47 UTC

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

target.sent.end.timestamp

 

Scope: Target request

Type: Long

Permission: Read

The timestamp value specifying when the proxy finished sending the request to the URL specified in the TargetEndpoint. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970 UTC.

 

target.sent.start.time

 

Scope: Target request

Type: String

Permission: Read

The time, expressed in string form, at which the proxy began sending the request to the URL specified in the TargetEndpoint. For example: Wed, 21 Aug 2013 19:16:47 UTC

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

target.sent.start.timestamp

 

Scope: Target request

Type: Long

Permission: Read

The timestamp value specifying when the proxy started sending the request to the URL specified in the TargetEndpoint. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970 UTC.

 

target.ssl.enabled

 

Scope: Proxy request

Type: Boolean

Permission: Read

Whether TargetEndpoint is running on TLS/SSL

 

target.url

 

Scope: Target request

Type: String

Permission: Read/Write

The URL configured in the TargetEndpoint XML file or the dynamic target URL (if target.url is set during the message flow). The variable does not include any additional path elements or query parameters. Returns null if called out of scope or otherwise unset.

 

variable.expectedcn

 

Scope: Proxy request

Type: String

Permission: Read/Write

Variable exposed for the common name if it’s running on TLS/SSL

 

virtualhost.aliases

 

Scope: Proxy request

Type: String_array

Permission: Read

Host aliases of the virtual host that is hit during a particular request

 

virtualhost.name

 

Scope: Proxy request

Type: String

Permission: Read

Name of the virtual host that serves the originating client request

 

virtualhost.ssl.enabled

 

Scope: Proxy request

Type: Boolean

Permission: Read

Returns true if TLS/SSL is enabled in the virtual host configuration

System Variables

Information pertaining to the system is described in system variables. Every system variable consists of two parts, a prefix _system and a function. For example: system.time, system is the prefix and time is the function. Supported system variables are listed in the System Variables table.

Variable

 

Description 

 

system.timestamp

 

Scope: Proxy request

Type: Long

Permission: Read

The timestamp value specifying when the request is received from the client at the ProxyEndpoint. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970, UTC.

 

system.time

 

Scope: Proxy request

Type: String

Permission: Read

The time, expressed in string form, at which the proxy received a request from a client at the ProxyEndpoint. For example Wed, 21 Aug 2013 19:16:47 UTC.

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

system.time.year

 

Scope: Proxy request

Type: Integer

Permission: Read

The year portion of the system.time variable.

 

system.time.month

 

Scope: Proxy request

Type: Integer

Permission: Read

The month portion of the system.time variable

 

system.time.day

 

Scope: Proxy request

Type: Integer

Permission: Read

The day of month portion of the system.time variable.

 

system.time.dayofweek

 

Scope: Proxy request

Type: Integer

Permission: Read

The day of the week portion of the system.time variable.

 

system.time.hour

 

Scope: Proxy request

Type: Integer

Permission: Read

The hour portion of the system.time variable.

 

system.time.minute

 

Scope: Proxy request

Type: Integer

Permission: Read

The minute portion of the system.time variable.

 

system.time.second

 

Scope: Proxy request

Type: Integer

Permission: Read

The second portion of the system.time variable.

 

system.time.millisecond

 

Scope: Proxy request

Type: Integer

Permission: Read

The millisecond portion of the system.time variable.

 

system.time.zone

 

Scope: Proxy request

Type: String

Permission: Read

Timezone of the system.

 

system.interface.{interface_name}

 

Scope: Proxy request

Type: String

Permission: Read

IP Address of the system.

 

system.pod.name

 

Scope: Proxy request

Type: String

Permission: Read

The name of the pod where the proxy is running.

 

system.region.name

 

Scope: Proxy request

Type: String

Permission: Read

The name of the data center region where the proxy is running.

 

system.uuid

 

Scope: Proxy request

Type: String

Permission: Read

The UUID of the message processor handling the proxy.

 

router.uuid

 

Scope:Proxy request

Type: String

Permission: Read

Response Message Variables

Response message variables are used in policies to access message components like the header, the query parameters, form parameters, the source IP address, the HTTP message body. API proxy applies the received response to a series of policies, depending on the request condition, API proxy can either modify or transform the request. Based on the content of the response variable, policies can either transform or reject the request. Supported response variables are listed in the Response Message Variables table.

Variable

 

 Description

 

 

client.sent.end.time

 

Scope: Proxy response

Type: String

Permission: Read

The time, expressed in string form, at which the proxy finished sending the response from the ProxyEndpoint to the client. For example Wed, 21 Aug 2013 19:16:47 UTC

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

client.sent.end.timestamp

 

Scope: Proxy response

Type: Long

Permission: Read

The timestamp value specifying when the proxy finished sending the response to the client from the ProxyEndpoint. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970 UTC.

 

client.sent.start.time

 

Scope: Proxy response

Type: String

Permission: Read

The time, expressed in string form, at which the proxy began sending the response from the ProxyEndpoint to the client. For example: Wed, 21 Aug 2013 19:16:47 UTC

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

client.sent.start.timestamp

 

Scope: Proxy response

Type: Long

Permission: Read

The timestamp value specifying when the proxy began sending the response to the client from the ProxyEndpoint. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970 UTC.

 

loadbalancing.failedservers

 

Scope: Target response

Type: String_array

Permission: Read

List of failed TargetServers during load balancing at TargetEndpoint

 

loadbalancing.isfallback

 

Scope: Target response

Type: Boolean

Permission: Read

Return true if fallback is enabled for the TargetServer invoked during load balancing at TargetEndpoint

 

loadbalancing.targetserver

 

Scope: Target response

Type: String

Permission: Read

TargetServer invoked during load balancing at TargetEndpoint. Set only if the <Path> element is set while defining the load balancer element.

 

message.reason.phrase

 

Scope: Target response

Type: String

Permission: Read

ReasonPhrase of the response message from target

 

message.status.code

 

Scope: Target response

Type: Integer

Permission: Read

HTTP status code of the response message from target

 

response

 

Scope: Target response

Type: Message

Permission: Read/Write

Complete response message returned by target

 

response.content

 

Scope: Target response

Type: String

Permission: Read/Write

Payload content of the response message returned by the target

 

response.formparam.{formparam_name}

 

Scope: Target response

Type: String

Permission: Read/Write

The value of a form parameter in the response

 

response.formparam.{formparam_name}.values.count

 

Scope: Target response

Type: Integer

Permission: Read

Count of all the values of the specified form parameter in response

 

response.formparams.count

 

Scope: Target response

Type: Integer

Permission: Read

Count of all form parameters in the response

 

response.formparams.names

 

Scope: Target response

Type: Collection

Permission: Read

The names of all the form parameters in the response

 

response.header.{header_name}

 

Scope: Target response

Type: String

Permission: Read/Write

Gets or sets the value of a specified HTTP header in the response. If the header has multiple values (such as a CSV list), a GET returns the first value only.

 

response.header.{header_name}.values

 

Scope begins: Target response

Type: Collection

Permission: Read

All the values of a specified HTTP header in response

 

response.header.{header_name}.values.count

 

Scope: Target response

Type: Integer

Permission: Read

Count of all the values of the specified HTTP header in response

 

response.headers.count

 

Scope: Target response

Type: Integer

Permission: Read

Count of all the headers in the response

 

response.headers.names

 

Scope: Target response

Type: Collection

Permission: Read

The names of all the headers in the response

 

response.reason.phrase

 

Scope: Target response

Type: String

Permission: Read/Write

The response reason phrase for a particular request

 

response.status.code

 

Scope: Target response

Type: Integer

Permission: Read/Write

The response code returned for a request. You can use this variable to override the response status code, which is stored in message.status.code.

 

response.transport.message

 

Scope: Target response

Type: String

Permission: Read

Response of type TransportMessage which is a contextual object

 

target.country

 

Scope: Target response

Type: String

Permission: Read

Country of the TLS/SSL certificate presented by the target server

 

target.email.address

 

Scope: Target response

Type: String

Permission: Read

Email address of the TLS/SSL certificate presented by the target server

 

target.organization

 

Scope: Target response

Type: String

Permission: Read

Organization of the TLS/SSL certificate presented by the target server

 

target.organization.unit

 

Scope: Target response

Type: String

Permission: Read

Organization unit of the TLS/SSL certificate presented by the target server

 

target.locality

 

Scope: Target response

Type: String

Permission: Read

Locality (city) of the TLS/SSL certificate presented by the target server

 

target.received.end.time

 

Scope: Target response

Type: String

Permission: Read

The time, expressed in string form, at which the TargetEndpoint started receiving the response from the target. For example: Wed, 21 Aug 2013 19:16:47 UTC

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

target.received.end.timestamp

 

Scope: Target response

Type: Long

Permission: Read

The timestamp value specifying when the TargetEndpoint finished receiving the response from the target. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970 UTC.

 

target.received.start.time

 

Scope: Target response

Type: String

Permission: Read

The time, expressed in string form, at which the TargetEndpoint finished receiving the response from the target. For example: Wed, 21 Aug 2013 19:16:47 UTC

This time value is the string representation of the corresponding 32-bit timestamp quantity. For example, ‘Wed, 21 Aug 2013 19:16:47 UTC’ corresponds to the timestamp value of 1377112607413.

 

target.received.start.timestamp

 

Scope: Target response

Type: Long

Permission: Read

The timestamp value specifying when the TargetEndpoint started receiving the response from the target. This value is a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970 UTC.

 

target.state

 

Scope: Target response

Type: String

Permission: Read

State of the TLS/SSL certificate presented by the target server

 

target.host

 

Scope: Target response

Type: String

Permission: Read

The domain name of the target service returning the response to the API proxy.

 

target.ip

 

Scope: Target response

Type: String

Permission: Read

The IP address of the target service returning the response to the API proxy.

 

target.port

 

Scope: Target response

Type: Integer

Permission: Read

The port number of the target service returning the response to the API proxy.

 

target.scheme

 

Scope: Target response

Type: String

Permission: Read/Write

Returns http or https depending on the request message

Message Variables

Message variables refer to different message types like request, response or error depending on the point within the APIproxy flow in which they are called. Supported message variables are listed in the Message Variables table.

Variable

 

 Description

 

 

message

 

Scope: Proxy request

Type: Message

Permission: Read/Write

A contextual object, with the same value as a request in the request Flow or as a response in the response Flow or as an error in the Error flow.

 

message.content

 

Scope: Proxy request

Type: String

Permission: Read/Write

Content of the request, response, or error message

 

message.formparam.{formparam_name}

 

Scope: Proxy request

Type: String

Permission: Read/Write

Value of the specified form parameter

 

message.formparam.{formparam_name}.values

 

Scope: Proxy request

Type: Collection

Permission: Read

All values of the specified form parameter in the message

 

message.formparam.{formparam_name}.values.count

 

Scope: Proxy request

Type: Integer

Permission: Read

Count of the values of the specified form parameters in the message

 

message.formparams.count

 

Scope: Proxy request

Type: Integer

Permission: Read

Count of all form parameters in the message

 

message.formparams.names

 

Scope: Proxy request

Type: Collection

Permission: Read

Value of all form parameters in the message

 

message.formstring

 

Scope: Proxy request

Type: String

Permission: Read

Value of form string in the message

 

message.header.{header_name}

 

Scope: Proxy request

Type: String

Permission: Read/Write

Gets or sets the value of the specified HTTP header in the message

 

message.reason.phrase

 

Scope: Target response

Type: String

Permission: Read

ReasonPhrase of the response message from target

 

message.status.code

 

Scope: Target response

Type: Integer

Permission: Read

HTTP status code of the response message from target

 

message.header.{header_name}.values

 

Scope: Proxy request

Type: Collection

Permission: Read

All values of the specified HTTP header name in the message

 

message.header.{header_name}.values.count

 

Scope: Proxy request

Type: Integer

Permission: Read

Count of the values of the specified HTTP header name in the message

 

message.headers.count

 

Scope: Proxy request

Type: Integer

Permission: Read

Count of all HTTP headers in the message

 

message.headers.names

 

Scope: Proxy request

Type: Integer

Permission: Read

Value of all HTTP headers in the message

 

messagelogging.{policy-name}.failed

 

Scope: Proxy request

Type: Boolean

Permission: Read

Failure flag for the referenced Message logging policy

 

messagelogging.failed

 

Scope:Proxy request

Type:

Permission:

Failure flag for Message logging policy

 

message.queryparam.{queryparam_name}.values

 

Scope: Proxy request

Type: Integer

Permission: Read

Value of the specified query parameter in the message

 

message.transport.message

 

Scope: Proxy request

Type: Transport_Message

Permission: Read

Message of type TransportMessage which is a contextual object

Error Variables

Supported error variables are listed in the Error Variables table.

Variable

 

 Description

 

 

error

 

Scope:Error

Type: Message

Permission: Read/Write

Error of type Message, which is a contextual object in the error flow

 

error.content

 

Scope: Error

Type: String

Permission: Read/Write

Content of the error

 

error.message

 

Scope: Error

Type: String

Permission: Read

The message associated with an error, whose value is available only before the error Flow is executed.

 

error.status.code

 

Scope: Error

Type: String

Permission: Read

The HTTP status code associated with the error. For example: “400”.

 

error.reason.phrase

 

Scope: Error

Type: String

Permission: Read

The reason phrase associated with the error. For example: “Bad Request”.

 

error.transport.message

 

Scope: Error

Type: Transport_Message

Permission: Read

Any error of type TransportMessage

 

error.state

 

Scope: Error

Type: Integer

Permission: Read

State in the Flow where an error occurred

 

error.header.<name>

 

Scope: Error

Type: String

Permission: Read/Write

Get or set the response header.

Configuration Variables

Configuration Variables describes the configuration settings. Supported configuration variables are listed in the Configuration Variables table.

Variable

 

 Description

 

 

organization.name

 

Scope: Proxy request

Type: String

Permission: Read

Name of the organization

 

environment

 

Scope: Proxy request

Type: String

Permission: Read

Container for environment.name.

 

environment.name

 

Scope: Proxy request

Type: String

Permission: Read

Name of the environment in which the transaction ran.

 

apiproxy.name

 

Scope: Proxy request

Type: String

Permission: Read

Name of the api proxy

 

apiproxy.revision

 

Scope: Proxy request

Type: String

Permission: Read

The revision number of an API proxy

 

is.error

 

Scope: Proxy request

Type: Boolean

Permission: Read

Error flag

 

proxy.name

 

Scope: Proxy request

Type: String

Permission: Read

The name attribute configured for the ProxyEndpoint

Path Variables

Supported path variables are listed in the Path Variables table.

Variable

 

Path

 

 Description

 

 

Request variables

 

request.uri The HTTP request path, which includes a path and a query string separated by a question mark ( ? )
request.path The HTTP request path without the query string
request.querystring The portion of the HTTP request path after the question mark ( ? )

 

Application variables

 

application.basepath The deployment base path (specified during API deployment)

 

Proxy variables

 

proxy.basepath The base path as configured in the proxy XML file.
proxy.pathsuffix . The portion of the request path after the proxy base path, which is determined by any conditional flow URIs

 

Target variables

 

request.url The complete URL of the final request made.
target.basepath The path (without a host or port) in the URL configured in the target XML file or the dynamic target URL (if target.url is set during the message flow)
target.url The URL configured in the target XML file or the dynamic target URL (if target.url is set during the message flow). Returns null if called out of scope or otherwise unset.

API Proxy Flows Variables

Supported API proxy flow variables are listed in the API proxy flow Variables table.

Variable Description 

 

current.flow.name

 

Scope: Proxy request

Type: String

Permission: Read

The name of the currently executed flow (such as “PreFlow”, “PostFlow”, or the name of a conditional flow).

 

current.flow.description

 

Scope: Proxy request

Type: String

Permission: Read

The description of the currently executed flow.

 

proxy.flow.name

 

Scope: Proxy request

Type: String

Permission: Read

The name of the most recently executed ProxyEndpoint flow (such as “PreFlow”, “PostFlow”, or the name of a conditional flow).

 

proxy.flow.description

 

Scope: Proxy request

Type: String

Permission: Read

The description of the most recently executed ProxyEndpoint flow.

 

target.flow.name

 

Scope: Target request

Type: String

Permission: Read

The name of the most recently executed TargetEndpoint flow (such as “PreFlow”, “PostFlow”, or the name of a conditional flow).

 

target.flow.description

 

Scope: Target request

Type: String

Permission: Read

The description of the most recently executed TargetEndpoint flow.

TLS/SSL Variables

TLS/SSL variables are generated when an API proxy executes a transaction over inbound TLS/SSL

Variable   Description

 

client.cn

 

Scope: Proxy request

Type: String

Permission: Read

The common name specified in the TLS/SSL certificate presented by the client app.

 

client.country

 

Scope: Proxy request

Type: String

Permission: Read

The country in the TLS/SSL certificate presented by the client app.

 

client.email.address

 

Scope: Proxy request

Type: String

Permission: Read

The email address in the TLS/SSL certificate presented by the client app.

 

client.organization

 

Scope: Proxy request

Type: String

Permission: Read

 

client.organization.unit

 

Scope: Proxy request

Type: String

Permission: Read

The organizational unit in the TLS/SSL certificate presented by the client.

 

client.locality

 

Scope: Proxy request

Type: String

Permission: Read

The locality (City) in the TLS/SSL certificate presented by the client.

 

client.state

 

Scope: Proxy request

Type: String

Permission: Read

The state in the TLS/SSL certificate presented by the client.

 

client.ssl.enabled

 

Scope: Proxy request

Type: String

Permission: Read

Returns true or false, depending on whether the ProxyEndpoint is configured for TLS/SSL.

Refer SAP Cloud Platform API Management Documentation for more help.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Shilpa Vij Post author

    Hello Rudnicki,

    If you go to policy editor we have suggestions which will suggest you how to use these variables.

    Regards

    Shilpa

     

    (0) 

Leave a Reply