

# API Gateway の REST API パラメータマッピング
<a name="rest-api-parameter-mapping"></a>

**注記**  
HTTP API を使用している場合は、「[API Gateway で HTTP API の API リクエストとレスポンスを変換する](http-api-parameter-mapping.md)」を参照してください。

パラメータマッピングでは、リクエストまたはレスポンスパラメータをマッピングします。パラメータのマッピングには、パラメータマッピング式または静的な値を使用できます。マッピング式のリストについては、「[API Gateway での REST API パラメータマッピングのソースのリファレンス](rest-api-parameter-mapping-sources.md)」を参照してください。パラメータマッピングは、プロキシ統合と非プロキシ統合の統合リクエストでは使用できますが、統合レスポンスでは、非プロキシ統合を使用する必要があります。

例えば、メソッドリクエストヘッダーパラメータ `puppies` を統合リクエストヘッダーパラメータ `DogsAge0` にマッピングできます。その後、クライアントが API にヘッダー `puppies:true` を送信すると、統合リクエストはリクエストヘッダー `DogsAge0:true` を統合エンドポイントに送信します。次の図は、この例のリクエストライフサイクルを説明しています。

![\[リクエストの API Gateway パラメータマッピングの例の図\]](http://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/images/parameter-mapping-example1.png)


API Gateway を使用してこの例を作成するには、「[例 1: メソッドリクエストパラメータを統合リクエストパラメータにマッピングする](request-response-data-mappings.md#request-response-data-mappings-example-1)」を参照してください。

 別の例としては、統合レスポンスヘッダーパラメータ `kittens` をメソッドレスポンスヘッダーパラメータ `CatsAge0` にマッピングすることもできます。その後、統合エンドポイントが `kittens:false` を返すと、クライアントはヘッダー `CatsAge0:false` を受け取ります。次の図は、この例のリクエストライフサイクルを説明しています。

![\[レスポンスの API Gateway パラメータマッピングの例の図\]](http://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/images/parameter-mapping-example2.png)


**Topics**
+ [API Gateway での REST API パラメータマッピングの例](request-response-data-mappings.md)
+ [API Gateway での REST API パラメータマッピングのソースのリファレンス](rest-api-parameter-mapping-sources.md)

# API Gateway での REST API パラメータマッピングの例
<a name="request-response-data-mappings"></a>

次の例は、API Gateway コンソール、OpenAPI、CloudFormation テンプレートを使用して、パラメータマッピング式を作成する方法を説明しています。パラメータマッピングを使用して必要な CORS ヘッダーを作成する方法の例については、「[API Gateway での REST API の CORS](how-to-cors.md)」を参照してください。

## 例 1: メソッドリクエストパラメータを統合リクエストパラメータにマッピングする
<a name="request-response-data-mappings-example-1"></a>

次の例では、メソッドリクエストヘッダーパラメータ `puppies` を統合リクエストヘッダーパラメータ `DogsAge0` にマッピングします。

------
#### [ AWS マネジメントコンソール ]

**メソッドリクエストパラメータをマッピングするには**

1. [https://console.aws.amazon.com/apigateway](https://console.aws.amazon.com/apigateway) で API Gateway コンソールにサインインします。

1. REST API を選択します。

1. メソッドを選択します。

   メソッドには非プロキシ統合が必要です。

1. **[メソッドリクエストの設定]** で、**[編集]** をクリックします。

1. **[HTTP リクエストヘッダー]** を選択します。

1. [**ヘッダーの追加**] を選択します。

1. **[Name]** (名前) には **puppies** を入力します。

1. **[保存]** を選択します。

1. **[統合リクエスト]** タブを選択し、**[統合リクエストの設定]** で、**[編集]** を選択します。

   AWS マネジメントコンソール は自動的に `method.request.header.puppies ` から `puppies` にパラメータマッピングを追加します。ただし、**[名前]** を統合エンドポイントで想定されるリクエストヘッダーパラメータと一致するように変更する必要があります。

1. **[Name]** (名前) には **DogsAge0** を入力します。

1. **[保存]** を選択します。

1. 変更を有効にするには、API を再デプロイします。

次の手順では、パラメータマッピングが正常に完了したかを確認する方法を説明します。

**(オプション) パラメータマッピングをテストする**

1. **[テスト]** タブを選択します。タブを表示するには、右矢印ボタンを選択する必要がある場合があります。

1. [ヘッダー] には、**puppies:true** と入力します。

1. **[テスト]** を選択します。

1. **[ログ]** では結果が以下のようになります。

   ```
   Tue Feb 04 00:28:36 UTC 2025 : Method request headers: {puppies=true}
   Tue Feb 04 00:28:36 UTC 2025 : Method request body before transformations: 
   Tue Feb 04 00:28:36 UTC 2025 : Endpoint request URI: http://petstore-demo-endpoint.execute-api.com/petstore/pets
   Tue Feb 04 00:28:36 UTC 2025 : Endpoint request headers: {DogsAge0=true, x-amzn-apigateway-api-id=abcd1234, Accept=application/json, User-Agent=AmazonAPIGateway_aaaaaaa, X-Amzn-Trace-Id=Root=1-abcd-12344}
   ```

   リクエストヘッダーパラメータが、`puppies` から `DogsAge0` に変更されました。

------
#### [ CloudFormation ]

 この例では、[body](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-body) プロパティを使用して、OpenAPI 定義ファイルを API Gateway にインポートします。

```
AWSTemplateFormatVersion: 2010-09-09
Resources:
  Api:
    Type: 'AWS::ApiGateway::RestApi'
    Properties:
      Body:
        openapi: 3.0.1
        info:
          title: ParameterMappingExample
          version: "2025-02-04T00:30:41Z"
        paths:
          /pets:
            get:
              parameters:
                - name: puppies
                  in: header
                  schema:
                    type: string
              responses:
                "200":
                  description: 200 response
              x-amazon-apigateway-integration:
                httpMethod: GET
                uri: http://petstore-demo-endpoint.execute-api.com/petstore/pets
                responses:
                  default:
                    statusCode: "200"
                requestParameters:
                  integration.request.header.DogsAge0: method.request.header.puppies
                passthroughBehavior: when_no_match
                type: http
  ApiGatewayDeployment:
    Type: 'AWS::ApiGateway::Deployment'
    DependsOn: Api 
    Properties: 
      RestApiId: !Ref Api
  ApiGatewayDeployment20250219:
    Type: 'AWS::ApiGateway::Deployment'
    DependsOn: Api 
    Properties: 
      RestApiId: !Ref Api
  Stage:
    Type: 'AWS::ApiGateway::Stage'
    Properties:
       DeploymentId: !Ref ApiGatewayDeployment20250219
       RestApiId: !Ref Api
       StageName: prod
```

------
#### [ OpenAPI ]

```
{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "ParameterMappingExample",
    "version" : "2025-02-04T00:30:41Z"
  },
  "paths" : {
    "/pets" : {
      "get" : {
        "parameters" : [ {
          "name" : "puppies",
          "in" : "header",
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "200 response"
          }
        },
        "x-amazon-apigateway-integration" : {
          "httpMethod" : "GET",
          "uri" : "http://petstore-demo-endpoint.execute-api.com/petstore/pets",
          "responses" : {
            "default" : {
              "statusCode" : "200"
            }
          },
          "requestParameters" : {
            "integration.request.header.DogsAge0" : "method.request.header.puppies"
          },
          "passthroughBehavior" : "when_no_match",
          "type" : "http"
        }
      }
    }
  }
}
```

------

## 例 2: 複数のメソッドリクエストパラメータを別々の統合リクエストパラメータにマッピングする
<a name="request-response-data-mappings-example-2"></a>

次の例では、複数値メソッドリクエストクエリ文字列パラメータ `methodRequestQueryParam` を統合リクエストクエリ文字列パラメータ `integrationQueryParam` にマッピングして、メソッドリクエストヘッダーパラメータ `methodRequestHeaderParam` を統合リクエストパスパラメータ `integrationPathParam` にマッピングします。

------
#### [ AWS マネジメントコンソール ]

**複数のメソッドリクエストパラメータをマッピングするには**

1. [https://console.aws.amazon.com/apigateway](https://console.aws.amazon.com/apigateway) で API Gateway コンソールにサインインします。

1. REST API を選択します。

1. メソッドを選択します。

   メソッドには非プロキシ統合が必要です。

1. **[メソッドリクエストの設定]** で、**[編集]** をクリックします。

1. **[URL クエリ文字列パラメータ]** を選択します。

1. [**クエリ文字列の追加**] を選択します。

1. **[Name]** (名前) には **methodRequestQueryParam** を入力します。

1. **[HTTP リクエストヘッダー]** を選択します。

1. [**ヘッダーの追加**] を選択します。

1. **[Name]** (名前) には **methodRequestHeaderParam** を入力します。

1. **[保存]** を選択します。

1. **[統合リクエスト]** タブを選択し、**[統合リクエストの設定]** で、**[編集]** を選択します。

1. **[URL パスパラメータ]** を選択します。

1. **[パスパラメータを追加]** を選択します。

1. **[Name]** (名前) には **integrationPathParam** を入力します。

1. **[マッピング元]** として「**method.request.header.methodRequestHeaderParam**」と入力します。

   これにより、メソッドリクエストで指定したメソッドリクエストヘッダーが新しい統合リクエストパスパラメータにマッピングされます。

1. **[URL クエリ文字列パラメータ]** を選択します。

1. [**クエリ文字列の追加**] を選択します。

1. **[Name]** (名前) には **integrationQueryParam** を入力します。

1. **[マッピング元]** として「**method.request.multivaluequerystring.methodRequestQueryParam**」と入力します。

   これにより、複数値クエリ文字列パラメータが新しい単一値統合リクエストクエリ文字列パラメータにマッピングされます。

1. **[保存]** を選択します。

1. 変更を有効にするには、API を再デプロイします。

------
#### [ CloudFormation ]

 この例では、[body](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-body) プロパティを使用して、OpenAPI 定義ファイルを API Gateway にインポートします。

次の OpenAPI 定義は、HTTP 統合のために以下のパラメータマッピングを作成します。
+ `methodRequestHeaderParam` という名前のメソッドリクエストのヘッダーから、`integrationPathParam` という名前の統合リクエストパスパラメータへのマッピング
+ `methodRequestQueryParam` という名前の複数値のメソッドリクエストから、`integrationQueryParam` という名前の統合リクエストのクエリ文字列へのマッピング

```
AWSTemplateFormatVersion: 2010-09-09
Resources:
  Api:
    Type: 'AWS::ApiGateway::RestApi'
    Properties:
      Body: 
        openapi: 3.0.1
        info:
          title: Parameter mapping example 2
          version: "2025-01-15T19:12:31Z"
        paths:
          /:
            post:
              parameters:
                - name: methodRequestQueryParam
                  in: query
                  schema:
                    type: string
                - name: methodRequestHeaderParam
                  in: header
                  schema:
                    type: string
              responses:
                "200":
                  description: 200 response
              x-amazon-apigateway-integration:
                httpMethod: GET
                uri: http://petstore-demo-endpoint.execute-api.com/petstore/pets
                responses:
                  default:
                    statusCode: "200"
                requestParameters:
                  integration.request.querystring.integrationQueryParam: method.request.multivaluequerystring.methodRequestQueryParam
                  integration.request.path.integrationPathParam: method.request.header.methodRequestHeaderParam
                requestTemplates:
                  application/json: '{"statusCode": 200}'
                passthroughBehavior: when_no_templates
                timeoutInMillis: 29000
                type: http
  ApiGatewayDeployment:
    Type: 'AWS::ApiGateway::Deployment'
    DependsOn: Api 
    Properties: 
      RestApiId: !Ref Api
  ApiGatewayDeployment20250219:
    Type: 'AWS::ApiGateway::Deployment'
    DependsOn: Api 
    Properties: 
      RestApiId: !Ref Api
  Stage:
    Type: 'AWS::ApiGateway::Stage'
    Properties:
       DeploymentId: !Ref ApiGatewayDeployment20250219
       RestApiId: !Ref Api
       StageName: prod
```

------
#### [ OpenAPI ]

次の OpenAPI 定義は、HTTP 統合のために以下のパラメータマッピングを作成します。
+ `methodRequestHeaderParam` という名前のメソッドリクエストのヘッダーから、`integrationPathParam` という名前の統合リクエストパスパラメータへのマッピング
+ `methodRequestQueryParam` という名前の複数値のメソッドリクエストから、`integrationQueryParam` という名前の統合リクエストのクエリ文字列へのマッピング

```
{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "Parameter mapping example 2",
    "version" : "2025-01-15T19:12:31Z"
  },
  "paths" : {
    "/" : {
      "post" : {
        "parameters" : [ {
          "name" : "methodRequestQueryParam",
          "in" : "query",
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "methodRequestHeaderParam",
          "in" : "header",
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "200 response"
          }
        },
        "x-amazon-apigateway-integration" : {
          "httpMethod" : "GET",
          "uri" : "http://petstore-demo-endpoint.execute-api.com/petstore/pets",
          "responses" : {
            "default" : {
              "statusCode" : "200"
            }
          },
          "requestParameters" : {
            "integration.request.querystring.integrationQueryParam" : "method.request.multivaluequerystring.methodRequestQueryParam",
            "integration.request.path.integrationPathParam" : "method.request.header.methodRequestHeaderParam"
          },
          "requestTemplates" : {
            "application/json" : "{\"statusCode\": 200}"
          },
          "passthroughBehavior" : "when_no_templates",
          "timeoutInMillis" : 29000,
          "type" : "http"
        }
      }
    }
  }
}
```

------

## 例 3: JSON リクエスト本文のフィールドを統合リクエストパラメータにマッピングする
<a name="request-response-data-mappings-example-3"></a>

統合リクエストのパラメータは、[JSONPath 式](http://goessner.net/articles/JsonPath/index.html#e2) を使用して JSON リクエスト本文のフィールドからマッピングすることもできます。次の例では、メソッドリクエスト本文を `body-header` という名前の統合リクエストヘッダーにマッピングし、JSON 式で表されるリクエスト本文の一部を `pet-price` という名前の統合リクエストヘッダーにマッピングします。

この例をテストするには、次のような料金カテゴリを含む入力を指定します。

```
[ 
  { 
    "id": 1, 
    "type": "dog", 
    "price": 249.99 
  }
]
```

------
#### [ AWS マネジメントコンソール ]

**複数のメソッドリクエストパラメータをマッピングするには**

1. [https://console.aws.amazon.com/apigateway](https://console.aws.amazon.com/apigateway) で API Gateway コンソールにサインインします。

1. REST API を選択します。

1. `POST` メソッド、`PUT` メソッド、`PATCH` メソッド、または `ANY` メソッドのいずれかを選択します。

   メソッドには非プロキシ統合が必要です。

1. **[統合リクエストの設定]**で、**[編集]** を選択します。

1. **[URLリクエストヘッダーのパラメータ]** をクリックします。

1. **[リクエストヘッダーのパラメータを追加]** をクリックします。

1. **[Name]** (名前) には **body-header** を入力します。

1. **[マッピング元]** として「**method.request.body**」と入力します。

   これにより、メソッドリクエスト本文が新しい統合リクエストヘッダーにマッピングされます。

1. **[リクエストヘッダーのパラメータを追加]** をクリックします。

1. **[Name]** (名前) には **pet-price** を入力します。

1. **[マッピング元]** として「** method.request.body[0].price**」と入力します。

   これにより、メソッドリクエスト本文の一部が新しい統合リクエストヘッダーにマッピングされます。

1. **[保存]** を選択します。

1. 変更を有効にするには、API を再デプロイします。

------
#### [ CloudFormation ]

 この例では、[body](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-body) プロパティを使用して、OpenAPI 定義ファイルを API Gateway にインポートします。

```
AWSTemplateFormatVersion: 2010-09-09
Resources:
  Api:
    Type: 'AWS::ApiGateway::RestApi'
    Properties:
      Body: 
        openapi: 3.0.1
        info:
          title: Parameter mapping example 3
          version: "2025-01-15T19:19:14Z"
        paths:
          /:
            post:
              responses:
                "200":
                  description: 200 response
              x-amazon-apigateway-integration:
                httpMethod: GET
                uri: http://petstore-demo-endpoint.execute-api.com/petstore/pets
                responses:
                  default:
                    statusCode: "200"
                requestParameters:
                  integration.request.header.pet-price: method.request.body[0].price
                  integration.request.header.body-header: method.request.body
                requestTemplates:
                  application/json: '{"statusCode": 200}'
                passthroughBehavior: when_no_templates
                timeoutInMillis: 29000
                type: http
  ApiGatewayDeployment:
    Type: 'AWS::ApiGateway::Deployment'
    DependsOn: Api 
    Properties: 
      RestApiId: !Ref Api
  ApiGatewayDeployment20250219:
    Type: 'AWS::ApiGateway::Deployment'
    DependsOn: Api 
    Properties: 
      RestApiId: !Ref Api
  Stage:
    Type: 'AWS::ApiGateway::Stage'
    Properties:
       DeploymentId: !Ref ApiGatewayDeployment20250219
       RestApiId: !Ref Api
       StageName: prod
```

------
#### [ OpenAPI ]

次の OpenAPI 定義は、JSON リクエスト本文の複数のフィールドから統合リクエストパラメータをマッピングします。

```
{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "Parameter mapping example 3",
    "version" : "2025-01-15T19:19:14Z"
  },
  "paths" : {
    "/" : {
      "post" : {
        "responses" : {
          "200" : {
            "description" : "200 response"
          }
        },
        "x-amazon-apigateway-integration" : {
          "httpMethod" : "GET",
          "uri" : "http://petstore-demo-endpoint.execute-api.com/petstore/pets",
          "responses" : {
            "default" : {
              "statusCode" : "200"
            }
          },
          "requestParameters" : {
            "integration.request.header.pet-price" : "method.request.body[0].price",
            "integration.request.header.body-header" : "method.request.body"
          },
          "requestTemplates" : {
            "application/json" : "{\"statusCode\": 200}"
          },
          "passthroughBehavior" : "when_no_templates",
          "timeoutInMillis" : 29000,
          "type" : "http"
        }
      }
    }
  }
}
```

------

## 例 4: 統合レスポンスをメソッドレスポンスにマッピングする
<a name="request-response-data-mappings-example-4"></a>

統合レスポンスをメソッドレスポンスにマップすることもできます。次の例では、統合レスポンス本文を `location` という名前のメソッドレスポンスヘッダーにマッピングし、統合レスポンスヘッダー `x-app-id` をメソッドレスポンスヘッダー `id` にマッピングして、複数値の統合レスポンスヘッダー `item` をメソッドレスポンスヘッダー `items` にマッピングします。

------
#### [ AWS マネジメントコンソール ]

**統合レスポンスをマッピングするには**

1. [https://console.aws.amazon.com/apigateway](https://console.aws.amazon.com/apigateway) で API Gateway コンソールにサインインします。

1. REST API を選択します。

1. メソッドを選択します。

   メソッドには非プロキシ統合が必要です。

1. **[メソッドレスポンス]** タブを選択して、**[レスポンス 200]** で **[編集]** を選択します。

1. **[ヘッダー名]** では、**[ヘッダーを追加]** を選択します。

1. **id**、**item**、**location** という名前の 3 つのヘッダーを作成します。

1. **[保存]** を選択します。

1. **[統合レスポンス]** タブをクリックして、**[デフォルト - レスポンス]** で、**[編集]** をクリックします。

1. **[ヘッダーのマッピング]** で、以下を入力します。

   1. **[ID]** には **integration.response.header.x-app-id** と入力する

   1. **[項目]** には **integration.response.multivalueheader.item** と入力する

   1. **[場所]** には **integration.response.body.redirect.url** と入力する

1. **[保存]** を選択します。

1. 変更を有効にするには、API を再デプロイします。

------
#### [ CloudFormation ]

 この例では、[body](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-body) プロパティを使用して、OpenAPI 定義ファイルを API Gateway にインポートします。

```
AWSTemplateFormatVersion: 2010-09-09
Resources:
  Api:
    Type: 'AWS::ApiGateway::RestApi'
    Properties:
      Body:
        openapi: 3.0.1
        info:
          title: Parameter mapping example
          version: "2025-01-15T19:21:35Z"
        paths:
          /:
            post:
              responses:
                "200":
                  description: 200 response
                  headers:
                    item:
                      schema:
                        type: string
                    location:
                      schema:
                        type: string
                    id:
                      schema:
                        type: string
              x-amazon-apigateway-integration:
                type: http
                httpMethod: GET
                uri: http://petstore-demo-endpoint.execute-api.com/petstore/pets
                responses:
                  default:
                    statusCode: "200"
                    responseParameters:
                      method.response.header.id: integration.response.header.x-app-id
                      method.response.header.location: integration.response.body.redirect.url
                      method.response.header.item: integration.response.multivalueheader.item
                requestTemplates:
                  application/json: '{"statusCode": 200}'
                passthroughBehavior: when_no_templates
                timeoutInMillis: 29000
  ApiGatewayDeployment:
    Type: 'AWS::ApiGateway::Deployment'
    DependsOn: Api 
    Properties: 
      RestApiId: !Ref Api
  ApiGatewayDeployment20250219:
    Type: 'AWS::ApiGateway::Deployment'
    DependsOn: Api 
    Properties: 
      RestApiId: !Ref Api
  Stage:
    Type: 'AWS::ApiGateway::Stage'
    Properties:
       DeploymentId: !Ref ApiGatewayDeployment20250219
       RestApiId: !Ref Api
       StageName: prod
```

------
#### [ OpenAPI ]

次の OpenAPI 定義は、統合レスポンスをメソッドレスポンスにマッピングします。

```
{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "Parameter mapping example",
    "version" : "2025-01-15T19:21:35Z"
  },
  "paths" : {
    "/" : {
      "post" : {
        "responses" : {
          "200" : {
            "description" : "200 response",
            "headers" : {
              "item" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "location" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "id" : {
                "schema" : {
                  "type" : "string"
                }
              }
            }
          }
        },
        "x-amazon-apigateway-integration" : {
          "type" : "http",
          "httpMethod" : "GET",
          "uri" : "http://petstore-demo-endpoint.execute-api.com/petstore/pets",
          "responses" : {
            "default" : {
              "statusCode" : "200",
              "responseParameters" : {
                "method.response.header.id" : "integration.response.header.x-app-id",
                "method.response.header.location" : "integration.response.body.redirect.url",
                "method.response.header.item" : "integration.response.multivalueheader.item"
              }
            }
          },
          "requestTemplates" : {
            "application/json" : "{\"statusCode\": 200}"
          },
          "passthroughBehavior" : "when_no_templates",
          "timeoutInMillis" : 29000
        }
      }
    }
  }
}
```

------

# API Gateway での REST API パラメータマッピングのソースのリファレンス
<a name="rest-api-parameter-mapping-sources"></a>

パラメータマッピングを作成する際は、変更するメソッドリクエストまたは統合レスポンスパラメータを指定して、これらのパラメータを変更する方法を指定します。

次の表は、マッピングできるメソッドリクエストパラメータと、マッピングを作成する式をまとめています。これらの式での *name* はメソッドリクエストパラメータ名です。例えば、リクエストヘッダーパラメータ `puppies` をマッピングするには、`method.request.header.puppies` という式を使用します。式は、正規表現 `'^[a-zA-Z0-9._$-]+$]'` と一致する必要があります。プロキシ統合と非プロキシ統合の統合リクエストでは、パラメータマッピングを使用できます。


| **マッピングされたデータソース** | **マッピング式** | 
| --- | --- | 
| メソッドリクエストのパス | method.request.path.name | 
| メソッドリクエストのクエリ文字列 | method.request.querystring.name | 
| 複数値メソッドリクエストのクエリ文字列 | method.request.multivaluequerystring.name | 
| メソッドリクエストのヘッダー | method.request.header.name | 
| 複数値メソッドリクエストのヘッダー | method.request.multivalueheader.name | 
| メソッドリクエストボディ | method.request.body | 
| メソッドリクエストボディ (JsonPath) | `method.request.body.JSONPath_EXPRESSION`. *JSONPath\$1EXPRESSION* はリクエスト本文の JSON フィールドの JSONPath 式です。詳細については、「[JSONPath 式](http://goessner.net/articles/JsonPath/index.html#e2)」を参照してください。  | 
| ステージ変数 | stageVariables.name | 
| コンテキスト変数 |  `context.name` 名前は、[サポートされるコンテキスト変数](api-gateway-mapping-template-reference.md#context-variable-reference)のいずれかである必要があります。 | 
| 静的な値 | `'static_value'`. *STATIC\$1VALUE* はリテラル文字列で、単一引用符のペアで囲まれている必要があります。例えば、`'https://www.example.com'`。 | 

次の表は、マッピングできる統合レスポンスパラメータと、マッピングを作成する式をまとめています。これらの式での *name* はメ統合レスポンスパラメータ名です。メソッドレスポンスヘッダーは、任意の統合レスポンスヘッダーまたは統合レスポンス本文、\$1context 変数、または静的な値からマップできます。統合レスポンスでパラメータマッピングを使用するには、非プロキシ統合を使用する必要があります。


| マッピングされたデータソース | マッピング式 | 
| --- | --- | 
| 統合レスポンスのヘッダー | integration.response.header.name | 
| 統合レスポンスのヘッダー | integration.response.multivalueheader.name | 
| 統合レスポンスの本文 | integration.response.body | 
| 統合レスポンスの本文 (JsonPath) | `integration.response.body.JSONPath_EXPRESSION` *JSONPath\$1EXPRESSION* はレスポンス本文の JSON フィールドの JSONPath 式です。詳細については、「[JSONPath 式](http://goessner.net/articles/JsonPath/index.html#e2)」を参照してください。 | 
| ステージ変数 | stageVariables.name | 
| コンテキスト変数 |  `context.name` 名前は、[サポートされるコンテキスト変数](api-gateway-mapping-template-reference.md#context-variable-reference)のいずれかである必要があります。 | 
| 静的な値 | ` 'static_value'` *STATIC\$1VALUE* はリテラル文字列で、単一引用符のペアで囲まれている必要があります。例えば、`'https://www.example.com'`。 | 