GetResourceCommand

Lists information about a resource.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { APIGatewayClient, GetResourceCommand } from "@aws-sdk/client-api-gateway"; // ES Modules import
// const { APIGatewayClient, GetResourceCommand } = require("@aws-sdk/client-api-gateway"); // CommonJS import
const client = new APIGatewayClient(config);
const input = { // GetResourceRequest
  restApiId: "STRING_VALUE", // required
  resourceId: "STRING_VALUE", // required
  embed: [ // ListOfString
    "STRING_VALUE",
  ],
};
const command = new GetResourceCommand(input);
const response = await client.send(command);
// { // Resource
//   id: "STRING_VALUE",
//   parentId: "STRING_VALUE",
//   pathPart: "STRING_VALUE",
//   path: "STRING_VALUE",
//   resourceMethods: { // MapOfMethod
//     "<keys>": { // Method
//       httpMethod: "STRING_VALUE",
//       authorizationType: "STRING_VALUE",
//       authorizerId: "STRING_VALUE",
//       apiKeyRequired: true || false,
//       requestValidatorId: "STRING_VALUE",
//       operationName: "STRING_VALUE",
//       requestParameters: { // MapOfStringToBoolean
//         "<keys>": true || false,
//       },
//       requestModels: { // MapOfStringToString
//         "<keys>": "STRING_VALUE",
//       },
//       methodResponses: { // MapOfMethodResponse
//         "<keys>": { // MethodResponse
//           statusCode: "STRING_VALUE",
//           responseParameters: {
//             "<keys>": true || false,
//           },
//           responseModels: {
//             "<keys>": "STRING_VALUE",
//           },
//         },
//       },
//       methodIntegration: { // Integration
//         type: "HTTP" || "AWS" || "MOCK" || "HTTP_PROXY" || "AWS_PROXY",
//         httpMethod: "STRING_VALUE",
//         uri: "STRING_VALUE",
//         connectionType: "INTERNET" || "VPC_LINK",
//         connectionId: "STRING_VALUE",
//         credentials: "STRING_VALUE",
//         requestParameters: "<MapOfStringToString>",
//         requestTemplates: "<MapOfStringToString>",
//         passthroughBehavior: "STRING_VALUE",
//         contentHandling: "CONVERT_TO_BINARY" || "CONVERT_TO_TEXT",
//         timeoutInMillis: Number("int"),
//         cacheNamespace: "STRING_VALUE",
//         cacheKeyParameters: [ // ListOfString
//           "STRING_VALUE",
//         ],
//         integrationResponses: { // MapOfIntegrationResponse
//           "<keys>": { // IntegrationResponse
//             statusCode: "STRING_VALUE",
//             selectionPattern: "STRING_VALUE",
//             responseParameters: "<MapOfStringToString>",
//             responseTemplates: "<MapOfStringToString>",
//             contentHandling: "CONVERT_TO_BINARY" || "CONVERT_TO_TEXT",
//           },
//         },
//         tlsConfig: { // TlsConfig
//           insecureSkipVerification: true || false,
//         },
//       },
//       authorizationScopes: [
//         "STRING_VALUE",
//       ],
//     },
//   },
// };

GetResourceCommand Input

See GetResourceCommandInput for more details

Parameter
Type
Description
resourceId
Required
string | undefined

The identifier for the Resource resource.

restApiId
Required
string | undefined

The string identifier of the associated RestApi.

embed
string[] | undefined

A query parameter to retrieve the specified resources embedded in the returned Resource representation in the response. This embed parameter value is a list of comma-separated strings. Currently, the request supports only retrieval of the embedded Method resources this way. The query parameter value must be a single-valued list and contain the "methods" string. For example, GET /restapis/{restapi_id}/resources/{resource_id}?embed=methods.

GetResourceCommand Output

See GetResourceCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
id
string | undefined

The resource's identifier.

parentId
string | undefined

The parent resource's identifier.

path
string | undefined

The full path for this resource.

pathPart
string | undefined

The last path segment for this resource.

resourceMethods
Record<string, Method> | undefined

Gets an API resource's method of a given HTTP verb.

Throws

Name
Fault
Details
NotFoundException
client

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

TooManyRequestsException
client

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

UnauthorizedException
client

The request is denied because the caller has insufficient permissions.

APIGatewayServiceException
Base exception class for all service exceptions from APIGateway service.