Data Objects and Variables Available in API Gateway
The following table summarizes the data objects and variables that are available in API Gateway:
The following data objects are available in the request processing or response processing steps:
${paramStage.paramType} You can use this syntax to access the following string variables: path, statusCode, statusMessage, httpMethod. Examples: ${request.path}, ${response.statusCode}
${paramStage.paramType.paramName} You can use this syntax to access map types, such as query, headers, and path. Example: ${request.query.var1}, ${response.header.Content-Type}, ${request.path.name}.
${paramStage.paramType.queryType[queryValue]} This syntax can be used to query a paramType. Examples:
${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, text/xml, or text/html.
${response.payload.jsonPath[$.cardDetails.number]} Where $.cardDetails.number is the jsonPath to be applied on payload if contentType is application/json or application/json/badgerfish.
${request.payload.regex[[0-9]+]} Where [0-9]+ is the regular expression to be applied on the payload if contentType is text/plain.
Note:
While xpath and jsonPath are applicable only to payload, regEx can be used with both payload and path.
${paramStage[stepName].paramType.paramName]} You can use this syntax to access header or payload from the response of the custom extension in the response processing step.
Example:
Variable: ${response.headers.id}
Value: ${response[customExtension].payload.jsonPath[$.id]}
This transformation adds a header to the response with name id and its value is derived from the json payload that is sent from the external callout as per the json path.
You can define your own variables in the Transformation variables field in the response processing step.
Examples: ${key}, ${value}. The custom transformation variables that you define are available in subsequent steps.