Cookie の設定を選択する

当社は、当社のサイトおよびサービスを提供するために必要な必須 Cookie および類似のツールを使用しています。当社は、パフォーマンス Cookie を使用して匿名の統計情報を収集することで、お客様が当社のサイトをどのように利用しているかを把握し、改善に役立てています。必須 Cookie は無効化できませんが、[カスタマイズ] または [拒否] をクリックしてパフォーマンス Cookie を拒否することはできます。

お客様が同意した場合、AWS および承認された第三者は、Cookie を使用して便利なサイト機能を提供したり、お客様の選択を記憶したり、関連する広告を含む関連コンテンツを表示したりします。すべての必須ではない Cookie を受け入れるか拒否するには、[受け入れる] または [拒否] をクリックしてください。より詳細な選択を行うには、[カスタマイズ] をクリックしてください。

CreateRestApi - Amazon API Gateway
このページはお客様の言語に翻訳されていません。 翻訳のリクエスト

CreateRestApi

Creates a new RestApi resource.

Request Syntax

POST /restapis HTTP/1.1 Content-type: application/json { "apiKeySource": "string", "binaryMediaTypes": [ "string" ], "cloneFrom": "string", "description": "string", "disableExecuteApiEndpoint": boolean, "endpointConfiguration": { "types": [ "string" ], "vpcEndpointIds": [ "string" ] }, "minimumCompressionSize": number, "name": "string", "policy": "string", "tags": { "string" : "string" }, "version": "string" }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

apiKeySource

The source of the API key for metering requests according to a usage plan. Valid values are: HEADER to read the API key from the X-API-Key header of a request. AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.

Type: String

Valid Values: HEADER | AUTHORIZER

Required: No

binaryMediaTypes

The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text payloads.

Type: Array of strings

Required: No

cloneFrom

The ID of the RestApi that you want to clone from.

Type: String

Required: No

description

The description of the RestApi.

Type: String

Required: No

disableExecuteApiEndpoint

Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint

Type: Boolean

Required: No

endpointConfiguration

The endpoint configuration of this RestApi showing the endpoint types of the API.

Type: EndpointConfiguration object

Required: No

minimumCompressionSize

A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.

Type: Integer

Required: No

name

The name of the RestApi.

Type: String

Required: Yes

policy

A stringified JSON policy document that applies to this RestApi regardless of the caller and Method configuration.

Type: String

Required: No

tags

The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with aws:. The tag value can be up to 256 characters.

Type: String to string map

Required: No

version

A version identifier for the API.

Type: String

Required: No

Response Syntax

HTTP/1.1 201 Content-type: application/json { "apiKeySource": "string", "binaryMediaTypes": [ "string" ], "createdDate": number, "description": "string", "disableExecuteApiEndpoint": boolean, "endpointConfiguration": { "types": [ "string" ], "vpcEndpointIds": [ "string" ] }, "id": "string", "minimumCompressionSize": number, "name": "string", "policy": "string", "rootResourceId": "string", "tags": { "string" : "string" }, "version": "string", "warnings": [ "string" ] }

Response Elements

If the action is successful, the service sends back an HTTP 201 response.

The following data is returned in JSON format by the service.

apiKeySource

The source of the API key for metering requests according to a usage plan. Valid values are: >HEADER to read the API key from the X-API-Key header of a request. AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.

Type: String

Valid Values: HEADER | AUTHORIZER

binaryMediaTypes

The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text payloads.

Type: Array of strings

createdDate

The timestamp when the API was created.

Type: Timestamp

description

The API's description.

Type: String

disableExecuteApiEndpoint

Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.

Type: Boolean

endpointConfiguration

The endpoint configuration of this RestApi showing the endpoint types of the API.

Type: EndpointConfiguration object

id

The API's identifier. This identifier is unique across all of your APIs in API Gateway.

Type: String

minimumCompressionSize

A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.

Type: Integer

name

The API's name.

Type: String

policy

A stringified JSON policy document that applies to this RestApi regardless of the caller and Method configuration.

Type: String

rootResourceId

The API's root resource ID.

Type: String

tags

The collection of tags. Each tag element is associated with a given resource.

Type: String to string map

version

A version identifier for the API.

Type: String

warnings

The warning messages reported when failonwarnings is turned on during API import.

Type: Array of strings

Errors

For information about the errors that are common to all actions, see Common Errors.

BadRequestException

The submitted request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.

HTTP Status Code: 400

ConflictException

The request configuration has conflicts. For details, see the accompanying error message.

HTTP Status Code: 409

LimitExceededException

The request exceeded the rate limit. Retry after the specified time period.

HTTP Status Code: 429

TooManyRequestsException

The request has reached its throttling limit. Retry after the specified time period.

HTTP Status Code: 429

UnauthorizedException

The request is denied because the caller has insufficient permissions.

HTTP Status Code: 401

Examples

Create a new API

This example illustrates one usage of CreateRestApi.

Sample Request

POST /restapis HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20160601T185340Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160601/us-east-1/apigateway/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature={sig4_hash} { "name" : "my-test-api", "description" : "A sample API created programmatically by calling API Gateway control service using the REST API" }

Sample Response

{ "_links": { "curies": [ ... ], "self": { "href": "/restapis/fugvjdxtri" }, "authorizer:by-id": { "href": "/restapis/fugvjdxtri/authorizers/{authorizer_id}", "templated": true }, "authorizer:create": { "href": "/restapis/fugvjdxtri/authorizers" }, "deployment:by-id": { "href": "/restapis/fugvjdxtri/deployments/{deployment_id}{?embed}", "templated": true }, "deployment:create": { "href": "/restapis/fugvjdxtri/deployments" }, "model:by-name": { "href": "/restapis/fugvjdxtri/models/{model_name}?flatten=false", "templated": true }, "model:create": { "href": "/restapis/fugvjdxtri/models" }, "resource:by-id": { "href": "/restapis/fugvjdxtri/resources/{resource_id}{?embed}", "templated": true }, "resource:create": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2" }, "restapi:authorizers": { "href": "/restapis/fugvjdxtri/authorizers" }, "restapi:delete": { "href": "/restapis/fugvjdxtri" }, "restapi:deployments": { "href": "/restapis/fugvjdxtri/deployments{?limit}", "templated": true }, "restapi:models": { "href": "/restapis/fugvjdxtri/models" }, "restapi:resources": { "href": "/restapis/fugvjdxtri/resources{?limit,embed}", "templated": true }, "restapi:stages": { "href": "/restapis/fugvjdxtri/stages{?deployment_id}", "templated": true }, "restapi:update": { "href": "/restapis/fugvjdxtri" }, "stage:by-name": { "href": "/restapis/fugvjdxtri/stages/{stage_name}", "templated": true }, "stage:create": { "href": "/restapis/fugvjdxtri/stages" } }, "createdDate": "2016-06-01T18:53:41Z", "description": "A sample API created programmatically by calling API Gateway control service using the REST API", "id": "fugvjdxtri", "name": "my-test-api" }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

プライバシーサイト規約Cookie の設定
© 2025, Amazon Web Services, Inc. or its affiliates.All rights reserved.