### Method Request Example Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-integration-settings-integration-request.md Example of a GET method request with path and query parameters. ```http GET /{var}?query=value Host: api.domain.net ``` -------------------------------- ### Complete API Example with CORS (OpenAPI 2.0) Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/enable-cors-for-resource-using-swagger-importer-tool.md An example demonstrating a complete API setup with GET and OPTIONS methods, including CORS configuration using OpenAPI 2.0. ```APIDOC ## Complete API Example with CORS (OpenAPI 2.0) ### Description This example defines an API with a root path ('/'). It includes a GET method for retrieving pet information and an OPTIONS method to handle CORS preflight requests, using OpenAPI 2.0 syntax. ### Method GET, OPTIONS ### Endpoint / ### Parameters #### Path Parameters None specified. #### Query Parameters None specified. #### Request Body None specified for GET. For OPTIONS, a JSON object is expected for the request template. ### Request Example For the OPTIONS method's request template: ```json { "statusCode": 200 } ``` ### Response #### Success Response (200) For GET: - **Access-Control-Allow-Origin** (string) - The allowed origin for CORS requests. For OPTIONS: - **Access-Control-Allow-Origin** (string) - The allowed origin for CORS requests. - **Access-Control-Allow-Methods** (string) - The allowed HTTP methods. - **Access-Control-Allow-Headers** (string) - The allowed request headers. #### Response Example For the GET method: ```json { "Access-Control-Allow-Origin": "'*'" } ``` For the OPTIONS method: ```json { "Access-Control-Allow-Methods": "'GET,OPTIONS'", "Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key'", "Access-Control-Allow-Origin": "'*'" } ``` ``` -------------------------------- ### Complete API Example with CORS (OpenAPI 3.0) Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/enable-cors-for-resource-using-swagger-importer-tool.md An example demonstrating a complete API setup with GET and OPTIONS methods, including CORS configuration using OpenAPI 3.0. ```APIDOC ## Complete API Example with CORS (OpenAPI 3.0) ### Description This example defines an API with a root path ('/'). It includes a GET method for retrieving pet information and an OPTIONS method to handle CORS preflight requests. ### Method GET, OPTIONS ### Endpoint / ### Parameters #### Path Parameters None specified. #### Query Parameters None specified. #### Request Body None specified for GET. For OPTIONS, a JSON object is expected for the request template. ### Request Example For the OPTIONS method's request template: ```json { "statusCode": 200 } ``` ### Response #### Success Response (200) For GET: - **Access-Control-Allow-Origin** (string) - The allowed origin for CORS requests. For OPTIONS: - **Access-Control-Allow-Origin** (string) - The allowed origin for CORS requests. - **Access-Control-Allow-Methods** (string) - The allowed HTTP methods. - **Access-Control-Allow-Headers** (string) - The allowed request headers. #### Response Example For the GET method: ```json { "Access-Control-Allow-Origin": "'*'" } ``` For the OPTIONS method: ```json { "Access-Control-Allow-Methods": "'GET,OPTIONS'", "Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key'", "Access-Control-Allow-Origin": "'*'" } ``` ``` -------------------------------- ### Example GET integration response output Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/models-mappings.md This is the raw output from the GET method before applying any mapping templates. ```json [ { "id": 1, "type": "dog", "price": 249.99 }, { "id": 2, "type": "cat", "price": 124.99 }, { "id": 3, "type": "fish", "price": 0.99 } ] ``` -------------------------------- ### Get Usage Data Example Source: https://docs.aws.amazon.com/apigateway/latest/api/API_GetUsage.html This example demonstrates how to retrieve usage data for a specific usage plan. ```APIDOC ## GET /usageplans/{usageplanId}/usage ### Description Retrieves usage data for a specified usage plan within a given date range. ### Method GET ### Endpoint `/usageplans/{usageplanId}/usage` ### Query Parameters - **startDate** (string) - Required - The start date for the usage data retrieval (YYYY-MM-DD). - **endDate** (string) - Required - The end date for the usage data retrieval (YYYY-MM-DD). ### Request Example ```http GET /usageplans/q2hrol/usage?startDate=2016-08-01&endDate=2016-08-04 HTTP/1.1 Host: apigateway.ap-southeast-1.amazonaws.com Content-Type: application/json Content-Length: 254 X-Amz-Date: 20160801T211516Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160801/ap-southeast-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sigv4_hash} ``` ### Response #### Success Response (200) - **startDate** (string) - The start date of the returned usage data. - **endDate** (string) - The end date of the returned usage data. - **usagePlanId** (string) - The ID of the usage plan. - **values** (object) - An object containing usage metrics. - **[metric_key]** (array) - An array of usage values for a specific metric. #### Response Example ```json { "_links": { "self": { "href": "/usageplans/q2hrol/usage?startDate=2016-08-01&endDate=2016-08-04" }, "first": { "href": "/usageplans/q2hrol/usage?startDate=2016-08-01&endDate=2016-08-04" } }, "endDate": "2016-08-04", "startDate": "2016-08-01", "usagePlanId": "q2hrol", "values": { "px1KW6TIqK6L8PfqZYR3R3rrFWSS74BB5qBazOJH6": [ [0, 5000], [0, 5000], [0, 10], [0, 10] ] } } ``` ``` -------------------------------- ### Example GET Request for PetStore API Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-method-settings.md This example shows a sample HTTP GET request to retrieve a pet from the PetStore API, demonstrating the use of a path parameter. ```http GET /pets/1 Host: apigateway.us-east-1.amazonaws.com ... ``` -------------------------------- ### Example Uncompressed Request Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-gzip-compression-decompression.md A sample GET request to the PetStore API. ```http GET /pets Host: {petstore-api-id}.execute-api.{region}.amazonaws.com Accept: application/json ``` -------------------------------- ### Java SDK Client Initialization and API Call Example Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This Java code snippet demonstrates how to initialize the SDK client and make calls to API methods like getABOp, getApiRoot, and postApiRoot. Ensure the App.java file is correctly set up with the package and imports. ```java package examples.aws.apig.simpleCalc.sdk.app; import java.io.IOException; ``` -------------------------------- ### Test GET request for Pets resource with API key Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.md This example demonstrates how to make a GET request to the Pets resource, including query parameters and the required API key header for testing usage plans. ```http GET /testStage/pets?type=dog&page=1 HTTP/1.1 x-api-key: Hiorr45VR...c4GJc Content-Type: application/x-www-form-urlencoded Host: xbvxlpijch.execute-api.ap-southeast-1.amazonaws.com X-Amz-Date: 20160803T001845Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160803/ap-southeast-1/execute-api/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-api-key, Signature={sigv4_hash} ``` -------------------------------- ### OpenAPI Example for Image Access via Lambda Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This OpenAPI file demonstrates an API setup for accessing images in Lambda, supporting both download (as base64) and upload (as raw binary) operations. ```yaml The following OpenAPI file shows an example API that illustrates downloading an image file from Lambda and uploading an image file to Lambda. ``` -------------------------------- ### API Documentation Part Response Example Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This is an example of a successful response when creating or updating a documentation part for an API entity. It includes the 'id', 'location', and 'properties' of the created or updated documentation part. ```JSON { "id": "s2e5xf", "location": { "path": null, "method": null, "name": null, "statusCode": null, "type": "API" }, "properties": "{\n\t\"info\": {\n\t\t\"description\" : \"Your first API with Amazon API Gateway.\"\n\t}\n}" } ``` -------------------------------- ### GET / Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md Retrieves a list of tasks. ```APIDOC ## GET / ### Description Returns a list of tasks. ### Method GET ### Endpoint / ### Parameters ### Request Body ### Request Example ### Response #### Success Response (200) - **id** (integer) - - **name** (string) - - **description** (string) - #### Response Example { "example": "[{"id": 1, "name": "Task 1", "description": "This is task 1"}]" } ``` -------------------------------- ### Proxy Resource Creation Output Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This is an example of the JSON output when a proxy resource is successfully created. ```json { "path": "/{proxy+}", "pathPart": "{proxy+}", "id": "234jdr", "parentId": "svzr202028x8" } ``` -------------------------------- ### Example CORS Response Headers Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This is an example of the HTTP response headers received when testing CORS with an OPTIONS request. It shows the presence and values of key CORS headers. ```http < HTTP/1.1 200 OK < Date: Tue, 19 May 2020 00:55:22 GMT < Content-Type: application/json < Content-Length: 0 < Connection: keep-alive < x-amzn-RequestId: a1b2c3d4-5678-90ab-cdef-abc123 < Access-Control-Allow-Origin: * < Access-Control-Allow-Headers: Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token < x-amz-apigw-id: Abcd= < Access-Control-Allow-Methods: DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT ``` -------------------------------- ### Configure Integration with Cache Key Parameter Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This command sets up an integration for a GET method, specifying that the 'type' method request parameter should be used as the cache key. ```bash aws apigateway put-integration \ --rest-api-id a1b2c3 \ --resource-id aaa111 \ --http-method GET \ --type HTTP \ --integration-http-method GET \ --uri 'https://example.com' \ --cache-key-parameters "method.request.querystring.type" ``` -------------------------------- ### Import Documentation Parts using API Gateway REST API Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This snippet demonstrates how to import API documentation parts into API Gateway using the REST API. It shows an example of overwriting existing documentation for a GET method. ```APIDOC ## PUT /restapis//documentation/parts ### Description Imports API documentation parts from an OpenAPI file into an API Gateway API. Supports merging or overwriting existing documentation. ### Method PUT ### Endpoint `/restapis//documentation/parts?mode=overwrite&failonwarnings=true` ### Query Parameters - **mode** (string) - Required - Specifies whether to merge or overwrite existing documentation. Example: `overwrite`. - **failonwarnings** (boolean) - Optional - If true, the import fails if warnings are encountered. Example: `true`. ### Request Body - **openapi** (string) - Required - The OpenAPI version. Example: `3.0.0`. - **info** (object) - Required - Provides metadata about the API. - **description** (string) - Description of the API. - **version** (string) - Version of the API. - **title** (string) - Title of the API. - **paths** (object) - Required - Defines the API paths and operations. - **[path]** (object) - Represents an API path. - **[method]** (object) - Represents an HTTP method for the path. - **description** (string) - Description of the method. - **responses** (object) - Defines the responses for the method. - **[status_code]** (object) - Defines a specific response status. - **description** (string) - Description of the response. - **x-amazon-apigateway-documentation** (object) - Custom extension for API Gateway documentation. - **version** (string) - Version of the documentation extension. Example: `1.0.3`. - **documentationParts** (array) - An array of documentation parts to import. - **location** (object) - Specifies the location of the documentation part. - **type** (string) - Type of the location (e.g., `API`, `METHOD`, `MODEL`, `RESPONSE`). - **method** (string) - HTTP method if type is `METHOD` or `RESPONSE`. - **statusCode** (string) - HTTP status code if type is `RESPONSE`. - **name** (string) - Name of the model if type is `MODEL`. - **properties** (object) - The documentation properties. - **description** (string) - Description for the documentation part. - **info** (object) - Additional info for API documentation. - **description** (string) - Description for API info. - **version** (string) - Version for API info. - **title** (string) - Title for the documentation part. - **servers** (array) - Optional - Defines the servers for the API. - **components** (object) - Optional - Defines reusable components like schemas. - **schemas** (object) - Defines the schemas. - **[schema_name]** (object) - Defines a specific schema. - **type** (string) - The type of the schema. - **title** (string) - The title of the schema. ### Request Example ```json { "openapi": "3.0.0", "info": { "description": "description", "version": "1", "title": "doc" }, "paths": { "/": { "get": { "description": "Method description.", "responses": { "200": { "description": "200 response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Empty" } } } } } } } }, "x-amazon-apigateway-documentation": { "version": "1.0.3", "documentationParts": [ { "location": { "type": "API" }, "properties": { "description": "API description", "info": { "description": "API info description 4", "version": "API info version 3" } } }, { "location": { "type": "METHOD", "method": "GET" }, "properties": { "description": "Method description." } }, { "location": { "type": "MODEL", "name": "Empty" }, "properties": { "title": "Empty Schema" } }, { "location": { "type": "RESPONSE", "method": "GET", "statusCode": "200" }, "properties": { "description": "200 response" } } ] }, "servers": [ { "url": "/" } ], "components": { "schemas": { "Empty": { "type": "object", "title": "Empty Schema" } } } } ``` ### Response #### Success Response (200) - **documentationParts** (array) - A list of imported documentation parts. - **warnings** (array) - A list of warnings encountered during import. ``` -------------------------------- ### GET / Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This endpoint retrieves information about the API root resource. It returns a 200 OK response with an empty schema. ```APIDOC ## GET / ### Description Retrieves information about the API root resource. ### Method GET ### Endpoint / ### Responses #### Success Response (200) - **Empty** (object) - An empty schema object. #### Response Example ```json {} ``` ``` -------------------------------- ### Configure Method Request Parameter as Cache Key Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md Use this command to create a GET method that requires the 'type' query string parameter, which can then be used as a cache key. ```bash aws apigateway put-method \ --rest-api-id a1b2c3 \ --resource-id aaa111 \ --http-method GET \ --authorization-type "NONE" \ --request-parameters "method.request.querystring.type=true" ``` -------------------------------- ### Example Uncompressed JSON Response Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md The backend responds with an uncompressed JSON payload. ```json 200 OK [ { "id": 1, "type": "dog", "price": 249.99 }, { "id": 2, "type": "cat", "price": 124.99 }, { "id": 3, "type": "fish", "price": 0.99 } ] ``` -------------------------------- ### Export API Documentation (YAML) Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This GET request exports the API documentation, including integrations, authorizers, and general documentation, in YAML format. ```APIDOC ## Export API Documentation (YAML) ### Description Exports the API documentation, including integrations, authorizers, and general documentation, in YAML format. ### Method GET ### Endpoint /restapis/{restapi_id}/stages/{stage_name}/exports/swagger?extensions=integrations,authorizers,documentation ### Query Parameters - **extensions** (string) - Required - Specifies the extensions to include in the export. Use 'integrations,authorizers,documentation' for this case. ### Headers - **Accept**: application/yaml - **Host**: apigateway.region.amazonaws.com - **Content-Type**: application/json - **X-Amz-Date**: YYYYMMDDTttttttZ - **Authorization**: AWS4-HMAC-SHA256 Credential=access_key_id/YYYYMMDD/region/apigateway/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature=sigv4_secret ``` -------------------------------- ### Export API Documentation (JSON) Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This GET request exports the API documentation, including integrations and general documentation, in JSON format. ```APIDOC ## Export API Documentation (JSON) ### Description Exports the API documentation, including integrations and general documentation, in JSON format. ### Method GET ### Endpoint /restapis/{restapi_id}/stages/{stage_name}/exports/swagger?extensions=integrations,documentation ### Query Parameters - **extensions** (string) - Required - Specifies the extensions to include in the export. Use 'integrations,documentation' for this case. ### Headers - **Accept**: application/json - **Host**: apigateway.region.amazonaws.com - **Content-Type**: application/json - **X-Amz-Date**: YYYYMMDDTttttttZ - **Authorization**: AWS4-HMAC-SHA256 Credential=access_key_id/YYYYMMDD/region/apigateway/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature=sigv4_secret ``` -------------------------------- ### GET / Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md Performs a calculation operation using query parameters for the numbers and operation. ```APIDOC ## GET / ### Description Performs a calculation operation using query parameters for the numbers and operation. ### Method GET ### Endpoint `/ ### Parameters #### Query Parameters - **op** (string) - Optional - The operation to perform. - **a** (string) - Optional - The first number for the operation. - **b** (string) - Optional - The second number for the operation. ### Response #### Success Response (200) - **input** (object) - Contains the input values for the operation. - **a** (string) - The first number. - **b** (string) - The second number. - **op** (string) - The operation performed. - **output** (object) - Contains the result of the operation. - **c** (string) - The result of the calculation. #### Response Example ```json { "input": { "a": "10", "b": "5", "op": "add" }, "output": { "c": "15" } } ``` ``` -------------------------------- ### GET /v1/s3 Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md Downloads a file from S3 as a raw binary blob. The `Accept` header should be set to a binary media type like `application/octet-stream`. ```APIDOC ## GET /v1/s3 ### Description Downloads a file from Amazon S3 as a raw binary blob. This is achieved by setting the `Accept` header to a binary media type and ensuring binary support is enabled in API Gateway. ### Method GET ### Endpoint /v1/s3 ### Query Parameters - **key** (string) - Optional - The key of the object to retrieve from S3. ### Request Example ```http GET /v1/s3?key=image.jpg HTTP/1.1 Host: abcdefghi.execute-api.us-east-1.amazonaws.com Content-Type: application/json Accept: application/octet-stream ``` ### Response #### Success Response (200) - **[raw bytes]** (binary) - The raw bytes of the requested file. #### Response Example ```http 200 OK HTTP/1.1 [raw bytes] ``` ``` -------------------------------- ### GET /a/{b}/{op} Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md Performs a calculation operation specified by 'op' on two numbers 'a' and 'b'. The numbers and operation are provided as path parameters. ```APIDOC ## GET /{a}/{b}/{op} ### Description Performs a calculation operation specified by 'op' on two numbers 'a' and 'b'. The numbers and operation are provided as path parameters. ### Method GET ### Endpoint `/{a}/{b}/{op}` ### Parameters #### Path Parameters - **a** (string) - Required - The first number for the operation. - **b** (string) - Required - The second number for the operation. - **op** (string) - Required - The operation to perform (e.g., add, subtract). ### Response #### Success Response (200) - **input** (object) - Contains the input values for the operation. - **a** (string) - The first number. - **b** (string) - The second number. - **op** (string) - The operation performed. - **output** (object) - Contains the result of the operation. - **c** (string) - The result of the calculation. #### Response Example ```json { "input": { "a": "10", "b": "5", "op": "add" }, "output": { "c": "15" } } ``` ``` -------------------------------- ### Lambda Authorizer Output Structure Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This is an example of the expected output from an API Gateway Lambda authorizer function. It must include a principalId and a policyDocument. An optional context map and usageIdentifierKey can also be returned. ```json { "principalId": "user|a1b2c3d4e5f6", "policyDocument": { "Version": "2012-10-17", "Statement": [ { "Action": "execute-api:Invoke", "Effect": "Allow", "Resource": "arn:aws:execute-api:us-east-1:123456789012:abcdef123/test/GET/request" } ] }, "context": { "key": "value" }, "usageIdentifierKey": "api_key_value" } ``` -------------------------------- ### API Gateway Update Domain Name Output (Edge-Optimized) Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.md This is an example output after successfully migrating a custom domain name to edge-optimized. It shows the distribution domain name which should be used for DNS configuration. ```json { "certificateArn": "arn:aws:acm:us-east-1:738575810317:certificate/34a95aa1-77fa-427c-aa07-3a88bd9f3c0a", "certificateName": "edge-cert", "certificateUploadDate": "2017-10-16T23:22:57Z", "distributionDomainName": "d1frvgze7vy1bf.cloudfront.net", "domainName": "api.example.com", "endpointConfiguration": { "types": [ "EDGE", "REGIONAL" ] }, "regionalCertificateArn": "arn:aws:acm:us-east-1:123456789012:certificate/3d881b54-851a-478a-a887-f6502760461d", "regionalDomainName": "d-cgkq2 quàgzf.execute-api.us-east-1.amazonaws.com" } ``` -------------------------------- ### Example Create Usage Plan Key Request Source: https://docs.aws.amazon.com/apigateway/latest/api/API_CreateUsagePlanKey.md Illustrates creating a usage plan key with specific IDs and type. ```HTTP POST /usageplans/n371pt/keys HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20160805T181755Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160805/us-east-1/apigateway/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature={sigv4_hash} { "keyId": "q5ugs7qjjh", "keyType": "API_KEY" } ``` -------------------------------- ### POST /methods with Query and Header Parameters Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-method-settings.md This example demonstrates setting up a GET method with optional query string and header parameters. ```APIDOC ## POST /methods with Query and Header Parameters ### Description Creates a method request and declares optional query string and header parameters. ### Method POST ### Endpoint /methods ### Parameters #### Path Parameters - **restApiId** (string) - Required - The ID of the REST API. - **resourceId** (string) - Required - The ID of the resource. #### Query Parameters - **httpMethod** (string) - Required - The HTTP method (e.g., GET). - **authorizationType** (string) - Required - The type of authorization (e.g., NONE). - **requestParameters** (object) - Required - A map of request parameters. For optional query parameters, use `method.request.querystring.=false`. For optional header parameters, use `method.request.header.=false`. ### Request Example ```bash aws apigateway put-method --rest-api-id vaz7da96z6 \ --resource-id 6sxz2j \ --http-method GET \ --authorization-type "NONE" \ --request-parameters method.request.querystring.type=false,method.request.header.age=false ``` ### Request Example (JSON String) ```bash aws apigateway put-method --rest-api-id vaz7da96z6 \ --resource-id 6sxz2j \ --http-method GET \ --authorization-type "NONE" \ --request-parameters '{"method.request.querystring.type":false,"method.request.header.age":false}' ``` ### Response #### Success Response (200) Details about the created method with the specified query and header parameters. #### Response Example (No specific example provided in the source text) ``` -------------------------------- ### Get Integration Response Example Source: https://docs.aws.amazon.com/apigateway/latest/api/API_Operations.md Example of a GET request to retrieve an integration response for a specific method, along with its successful JSON response. ```APIDOC ## GET /restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code} ### Description Retrieves the integration response for a given method, resource, and status code. ### Method GET ### Endpoint /restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code} ### Request Example ```http GET /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200 HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20160607T191449Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160607/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash} ``` ### Response #### Success Response (200) - **statusCode** (string) - The HTTP status code of the integration response. - **responseParameters** (object) - A map of response parameters that can be sent to the client. - **responseTemplates** (object) - A map of templates that can be used to transform the integration response. #### Response Example ```json { "_links": { "curies": { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true }, "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "title": "200" }, "integrationresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" }, "integrationresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" } }, "responseParameters": { "method.response.header.Content-Type": "'application/xml'" }, "responseTemplates": { "application/json": "$util.urlDecode(\"%3CkinesisStreams%3E#foreach($stream in $input.path('$.StreamNames'))%3Cstream%3E%3Cname%3E$stream%3C/name%3E%3C/stream%3E#end%3C/kinesisStreams%3E\")\n" }, "statusCode": "200" } ``` ### Errors - **BadRequestException**: The submitted request is not valid. - **NotFoundException**: The requested resource is not found. - **TooManyRequestsException**: The request has reached its throttling limit. - **UnauthorizedException**: The request is denied due to insufficient permissions. ``` -------------------------------- ### Example Create Usage Plan Key Response Source: https://docs.aws.amazon.com/apigateway/latest/api/API_CreateUsagePlanKey.md Shows a successful response after creating a usage plan key, including its ID and type. ```JSON { "_links": { "self": { "href": "/usageplans/n371pt/keys/q5ugs7qjjh" } }, "id": "q5ugs7qjjh", "name": " importedKey_2", "type": "API_KEY" } ``` -------------------------------- ### GET /protected-by-iam - IAM Authorization Example Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-auth.md Example demonstrating how to set the authorization type to AWS_IAM for a GET method on the /protected-by-iam endpoint using OpenAPI 3.0.1. ```APIDOC ## GET /protected-by-iam ### Description This endpoint is protected by AWS IAM authorization. ### Method GET ### Endpoint /protected-by-iam ### Request Body This endpoint does not have a request body. ### Response #### Success Response (200) - **message** (string) - A success message. #### Response Example ```json { "message": "Successfully accessed protected resource" } ``` ### OpenAPI 3.0.1 Example ```json { "openapi": "3.0.1", "info": { "title": "openapi3", "version": "1.0" }, "paths": { "/protected-by-iam": { "get": { "x-amazon-apigateway-auth": { "type": "AWS_IAM" } } } } } ``` ``` -------------------------------- ### Update a usage plan example Source: https://docs.aws.amazon.com/apigateway/latest/api/API_UpdateUsagePlan.md This example demonstrates how to update a usage plan. It shows a typical request structure for modifying plan details. ```json PATCH /usageplans/a1b2c3d4e5f6 HTTP/1.1 Content-type: application/json { "patchOperations": [ { "op": "replace", "path": "/name", "value": "MyUpdatedUsagePlanName" } ] } ``` -------------------------------- ### Get Models API Example Source: https://docs.aws.amazon.com/apigateway/latest/api/API_Operations.md Example of how to retrieve the collection of models defined for an API. ```APIDOC ## GET /restapis/{restapi_id}/models ### Description Retrieves the collection of models defined for a specific API. ### Method GET ### Endpoint /restapis/{restapi_id}/models ### Parameters #### Path Parameters - **restapi_id** (string) - Required - The ID of the REST API. ### Request Example ``` GET /restapis/l9kujxkzq2/models HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com Content-Length: 60 X-Amz-Date: 20170223T172652Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20170223/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash} ``` ### Response #### Success Response (200) - **_links** (object) - Contains links to related resources. - **_embedded** (object) - Contains embedded resources, such as the list of models. #### Response Example ```json { "_links": { "curies": { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-model-{rel}.html", "name": "model", "templated": true }, "self": { "href": "/restapis/l9kujxkzq2/models" }, "item": [ { "href": "/restapis/l9kujxkzq2/models/Empty?flatten=false" }, { "href": "/restapis/l9kujxkzq2/models/Error?flatten=false" } ], "model:by-name": { "href": "/restapis/l9kujxkzq2/models/{model_name}?flatten=false", "templated": true } }, "_embedded": { "item": [ { "_links": { "self": { "href": "/restapis/l9kujxkzq2/models/Empty?flatten=false" }, "model:create": { "href": "/restapis/l9kujxkzq2/models" }, "model:delete": { "href": "/restapis/l9kujxkzq2/models/Empty" }, "model:generate-template": { "href": "/restapis/l9kujxkzq2/models/Empty/default_template" }, "model:update": { "href": "/restapis/l9kujxkzq2/models/Empty" } }, "contentType": "application/json", "description": "This is a default empty schema model", "id": "71l0yh", "name": "Empty", "schema": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"title\" : \"Empty Schema\",\n \"type\" : \"object\"\n}" }, { "_links": { "self": { "href": "/restapis/l9kujxkzq2/models/Error?flatten=false" }, "model:create": { "href": "/restapis/l9kujxkzq2/models" }, "model:delete": { "href": "/restapis/l9kujxkzq2/models/Error" }, "model:generate-template": { "href": "/restapis/l9kujxkzq2/models/Error/default_template" }, "model:update": { "href": "/restapis/l9kujxkzq2/models/Error" } }, "contentType": "application/json", "description": "This is a default error schema model", "id": "sddpxt", "name": "Error", "schema": "{\n \"$schema\" : \"http://json-schema.org/draft-04/schema#\",\n \"title\" : \"Error Schema\",\n \"type\" : \"object\",\n \"properties\" : {\n \"message\" : { \"type\" : \"string\" }\n }\n}" } ] } } ``` ``` -------------------------------- ### OPTIONS /hello Source: https://docs.aws.amazon.com/apigateway/latest/api/API_PutRestApi.md Handles CORS preflight requests for the '/hello' endpoint. This example uses a mock integration. ```APIDOC ## OPTIONS /hello ### Description Handles CORS preflight requests for the '/hello' endpoint. This endpoint is configured with a mock integration to return appropriate CORS headers. ### Method OPTIONS ### Endpoint /hello ### Request Body None ### Response #### Success Response (200) - **Access-Control-Allow-Origin** (string) - Specifies the allowed origin for CORS requests. - **Access-Control-Allow-Methods** (string) - Specifies the allowed HTTP methods. - **Access-Control-Allow-Headers** (string) - Specifies the allowed request headers. #### Response Example ```json { "statusCode": 200 } ``` ```