选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

CreateStage - Amazon API Gateway
此页面尚未翻译为您的语言。 请求翻译

CreateStage

Creates a new Stage resource that references a pre-existing Deployment for the API.

Request Syntax

POST /restapis/restapi_id/stages HTTP/1.1 Content-type: application/json { "cacheClusterEnabled": boolean, "cacheClusterSize": "string", "canarySettings": { "deploymentId": "string", "percentTraffic": number, "stageVariableOverrides": { "string" : "string" }, "useStageCache": boolean }, "deploymentId": "string", "description": "string", "documentationVersion": "string", "stageName": "string", "tags": { "string" : "string" }, "tracingEnabled": boolean, "variables": { "string" : "string" } }

URI Request Parameters

The request uses the following URI parameters.

restapi_id

The string identifier of the associated RestApi.

Required: Yes

Request Body

The request accepts the following data in JSON format.

cacheClusterEnabled

Whether cache clustering is enabled for the stage.

Type: Boolean

Required: No

cacheClusterSize

The stage's cache capacity in GB. For more information about choosing a cache size, see Enabling API caching to enhance responsiveness.

Type: String

Valid Values: 0.5 | 1.6 | 6.1 | 13.5 | 28.4 | 58.2 | 118 | 237

Required: No

canarySettings

The canary deployment settings of this stage.

Type: CanarySettings object

Required: No

deploymentId

The identifier of the Deployment resource for the Stage resource.

Type: String

Required: Yes

description

The description of the Stage resource.

Type: String

Required: No

documentationVersion

The version of the associated API documentation.

Type: String

Required: No

stageName

The name for the Stage resource. Stage names can only contain alphanumeric characters, hyphens, and underscores. Maximum length is 128 characters.

Type: String

Required: Yes

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

tracingEnabled

Specifies whether active tracing with X-ray is enabled for the Stage.

Type: Boolean

Required: No

variables

A map that defines the stage variables for the new Stage resource. Variable names can have alphanumeric and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+.

Type: String to string map

Required: No

Response Syntax

HTTP/1.1 201 Content-type: application/json { "accessLogSettings": { "destinationArn": "string", "format": "string" }, "cacheClusterEnabled": boolean, "cacheClusterSize": "string", "cacheClusterStatus": "string", "canarySettings": { "deploymentId": "string", "percentTraffic": number, "stageVariableOverrides": { "string" : "string" }, "useStageCache": boolean }, "clientCertificateId": "string", "createdDate": number, "deploymentId": "string", "description": "string", "documentationVersion": "string", "lastUpdatedDate": number, "methodSettings": { "string" : { "cacheDataEncrypted": boolean, "cacheTtlInSeconds": number, "cachingEnabled": boolean, "dataTraceEnabled": boolean, "loggingLevel": "string", "metricsEnabled": boolean, "requireAuthorizationForCacheControl": boolean, "throttlingBurstLimit": number, "throttlingRateLimit": number, "unauthorizedCacheControlHeaderStrategy": "string" } }, "stageName": "string", "tags": { "string" : "string" }, "tracingEnabled": boolean, "variables": { "string" : "string" }, "webAclArn": "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.

accessLogSettings

Settings for logging access in this stage.

Type: AccessLogSettings object

cacheClusterEnabled

Specifies whether a cache cluster is enabled for the stage. To activate a method-level cache, set CachingEnabled to true for a method.

Type: Boolean

cacheClusterSize

The stage's cache capacity in GB. For more information about choosing a cache size, see Enabling API caching to enhance responsiveness.

Type: String

Valid Values: 0.5 | 1.6 | 6.1 | 13.5 | 28.4 | 58.2 | 118 | 237

cacheClusterStatus

The status of the cache cluster for the stage, if enabled.

Type: String

Valid Values: CREATE_IN_PROGRESS | AVAILABLE | DELETE_IN_PROGRESS | NOT_AVAILABLE | FLUSH_IN_PROGRESS

canarySettings

Settings for the canary deployment in this stage.

Type: CanarySettings object

clientCertificateId

The identifier of a client certificate for an API stage.

Type: String

createdDate

The timestamp when the stage was created.

Type: Timestamp

deploymentId

The identifier of the Deployment that the stage points to.

Type: String

description

The stage's description.

Type: String

documentationVersion

The version of the associated API documentation.

Type: String

lastUpdatedDate

The timestamp when the stage last updated.

Type: Timestamp

methodSettings

A map that defines the method settings for a Stage resource. Keys (designated as /{method_setting_key below) are method paths defined as {resource_path}/{http_method} for an individual method override, or /\*/\* for overriding all methods in the stage.

Type: String to MethodSetting object map

stageName

The name of the stage is the first path segment in the Uniform Resource Identifier (URI) of a call to API Gateway. Stage names can only contain alphanumeric characters, hyphens, and underscores. Maximum length is 128 characters.

Type: String

tags

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

Type: String to string map

tracingEnabled

Specifies whether active tracing with X-ray is enabled for the Stage.

Type: Boolean

variables

A map that defines the stage variables for a Stage resource. Variable names can have alphanumeric and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+.

Type: String to string map

webAclArn

The ARN of the WebAcl associated with the Stage.

Type: String

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

NotFoundException

The requested resource is not found. Make sure that the request URI is correct.

HTTP Status Code: 404

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 stage for a deployed API

This example illustrates one usage of CreateStage.

Sample Request

POST /restapis/uycll6xg9a/stages HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20170223T200249Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20170223/us-east-1/apigateway/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature={sig4_hash} { "stageName" : "alpha", "deploymentId" : "vakw79", "description" : "alpha stage", "cacheClusterEnabled" : "true", "cacheClusterSize" : "0.5", "variables" : { "sv_1" : "value_1", "sv_2" : "value_2" } }

Sample Response

{ "_links": { "curies": { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-stage-{rel}.html", "name": "stage", "templated": true }, "self": { "href": "/restapis/uycll6xg9a/stages/alpha" }, "stage:delete": { "href": "/restapis/uycll6xg9a/stages/alpha" }, "stage:flush-authorizer-cache": { "href": "/restapis/uycll6xg9a/stages/alpha/cache/authorizers" }, "stage:flush-cache": { "href": "/restapis/uycll6xg9a/stages/alpha/cache/data" }, "stage:update": { "href": "/restapis/uycll6xg9a/stages/alpha" } }, "cacheClusterEnabled": true, "cacheClusterSize": "0.5", "cacheClusterStatus": "CREATE_IN_PROGRESS", "createdDate": "2016-06-08T20:02:50Z", "deploymentId": "vakw79", "description": "alpha stage", "lastUpdatedDate": "2016-06-08T20:02:50Z", "methodSettings": {}, "stageName": "alpha", "variables": { "sv_2": "value_2", "sv_1": "value_1" } }

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. 或其附属公司。保留所有权利。