Routes - Amazon API Gateway

Routes

Represents the collection of routes for an API.

URI

/v2/apis/apiId/routes

HTTP methods

GET

Operation ID: GetRoutes

Gets the Routes for an API.

Path parameters
NameTypeRequiredDescription
apiIdStringTrue

The API identifier.

Query parameters
NameTypeRequiredDescription
nextTokenStringFalse

The next page of elements from this collection. Not valid for the last element of the collection.

maxResultsStringFalse

The maximum number of elements to be returned for this resource.

Responses
Status codeResponse modelDescription
200Routes

Success

400BadRequestException

One of the parameters in the request is invalid.

404NotFoundException

The resource specified in the request was not found.

429LimitExceededException

The client is sending more than the allowed number of requests per unit of time.

POST

Operation ID: CreateRoute

Creates a Route for an API.

Path parameters
NameTypeRequiredDescription
apiIdStringTrue

The API identifier.

Responses
Status codeResponse modelDescription
201Route

The request has succeeded and has resulted in the creation of a resource.

400BadRequestException

One of the parameters in the request is invalid.

404NotFoundException

The resource specified in the request was not found.

409ConflictException

The resource already exists.

429LimitExceededException

The client is sending more than the allowed number of requests per unit of time.

Schemas

Request bodies

{ "routeKey": "string", "authorizationType": enum, "authorizerId": "string", "authorizationScopes": [ "string" ], "apiKeyRequired": boolean, "requestParameters": { }, "requestModels": { }, "modelSelectionExpression": "string", "target": "string", "operationName": "string", "routeResponseSelectionExpression": "string" }

Response bodies

{ "items": [ { "routeId": "string", "routeKey": "string", "authorizationType": enum, "authorizerId": "string", "authorizationScopes": [ "string" ], "apiKeyRequired": boolean, "requestParameters": { }, "requestModels": { }, "modelSelectionExpression": "string", "target": "string", "operationName": "string", "routeResponseSelectionExpression": "string", "apiGatewayManaged": boolean } ], "nextToken": "string" }
{ "routeId": "string", "routeKey": "string", "authorizationType": enum, "authorizerId": "string", "authorizationScopes": [ "string" ], "apiKeyRequired": boolean, "requestParameters": { }, "requestModels": { }, "modelSelectionExpression": "string", "target": "string", "operationName": "string", "routeResponseSelectionExpression": "string", "apiGatewayManaged": boolean }
{ "message": "string" }
{ "message": "string", "resourceType": "string" }
{ "message": "string" }
{ "message": "string", "limitType": "string" }

Properties

AuthorizationType

The authorization type. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer.

  • NONE

  • AWS_IAM

  • CUSTOM

  • JWT

BadRequestException

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

PropertyTypeRequiredDescription
message

string

False

Describes the error encountered.

ConflictException

The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.

PropertyTypeRequiredDescription
message

string

False

Describes the error encountered.

CreateRouteInput

Represents the input parameters for a CreateRoute request.

PropertyTypeRequiredDescription
apiKeyRequired

boolean

False

Specifies whether an API key is required for the route. Supported only for WebSocket APIs.

authorizationScopes

Array of type string

False

The authorization scopes supported by this route.

authorizationType

AuthorizationType

False

The authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer.

authorizerId

string

False

The identifier of the Authorizer resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer.

modelSelectionExpression

string

False

The model selection expression for the route. Supported only for WebSocket APIs.

operationName

string

False

The operation name for the route.

requestModels

RouteModels

False

The request models for the route. Supported only for WebSocket APIs.

requestParameters

RouteParameters

False

The request parameters for the route. Supported only for WebSocket APIs.

routeKey

string

True

The route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.

routeResponseSelectionExpression

string

False

The route response selection expression for the route. Supported only for WebSocket APIs.

target

string

False

The target for the route.

LimitExceededException

A limit has been exceeded. See the accompanying error message for details.

PropertyTypeRequiredDescription
limitType

string

False

The limit type.

message

string

False

Describes the error encountered.

NotFoundException

The resource specified in the request was not found. See the message field for more information.

PropertyTypeRequiredDescription
message

string

False

Describes the error encountered.

resourceType

string

False

The resource type.

ParameterConstraints

Validation constraints imposed on parameters of a request (path, query string, headers).

PropertyTypeRequiredDescription
required

boolean

False

Whether or not the parameter is required.

Route

Represents a route.

PropertyTypeRequiredDescription
apiGatewayManaged

boolean

False

Specifies whether a route is managed by API Gateway. If you created an API using quick create, the $default route is managed by API Gateway. You can't modify the $default route key.

apiKeyRequired

boolean

False

Specifies whether an API key is required for this route. Supported only for WebSocket APIs.

authorizationScopes

Array of type string

False

A list of authorization scopes configured on a route. The scopes are used with a JWT authorizer to authorize the method invocation. The authorization works by matching the route scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any route scope matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the route scope is configured, the client must provide an access token instead of an identity token for authorization purposes.

authorizationType

AuthorizationType

False

The authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer.

authorizerId

string

False

The identifier of the Authorizer resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer.

modelSelectionExpression

string

False

The model selection expression for the route. Supported only for WebSocket APIs.

operationName

string

False

The operation name for the route.

requestModels

RouteModels

False

The request models for the route. Supported only for WebSocket APIs.

requestParameters

RouteParameters

False

The request parameters for the route. Supported only for WebSocket APIs.

routeId

string

False

The route ID.

routeKey

string

True

The route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.

routeResponseSelectionExpression

string

False

The route response selection expression for the route. Supported only for WebSocket APIs.

target

string

False

The target for the route.

RouteModels

The route models.

PropertyTypeRequiredDescription

*

string

False

RouteParameters

The route parameters.

PropertyTypeRequiredDescription

*

object

False

Routes

Represents a collection of routes.

PropertyTypeRequiredDescription
items

Array of type Route

False

The elements from this collection.

nextToken

string

False

The next page of elements from this collection. Not valid for the last element of the collection.

See also

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

GetRoutes

CreateRoute