GetResource - Amazon API Gateway

GetResource

Lists information about a resource.

Request Syntax

GET /restapis/restapi_id/resources/resource_id?embed=embed HTTP/1.1

URI Request Parameters

The request uses the following URI parameters.

embed

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.

resource_id

The identifier for the Resource resource.

Required: Yes

restapi_id

The string identifier of the associated RestApi.

Required: Yes

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200 Content-type: application/json { "id": "string", "parentId": "string", "path": "string", "pathPart": "string", "resourceMethods": { "string" : { "apiKeyRequired": boolean, "authorizationScopes": [ "string" ], "authorizationType": "string", "authorizerId": "string", "httpMethod": "string", "methodIntegration": { "cacheKeyParameters": [ "string" ], "cacheNamespace": "string", "connectionId": "string", "connectionType": "string", "contentHandling": "string", "credentials": "string", "httpMethod": "string", "integrationResponses": { "string" : { "contentHandling": "string", "responseParameters": { "string" : "string" }, "responseTemplates": { "string" : "string" }, "selectionPattern": "string", "statusCode": "string" } }, "passthroughBehavior": "string", "requestParameters": { "string" : "string" }, "requestTemplates": { "string" : "string" }, "timeoutInMillis": number, "tlsConfig": { "insecureSkipVerification": boolean }, "type": "string", "uri": "string" }, "methodResponses": { "string" : { "responseModels": { "string" : "string" }, "responseParameters": { "string" : boolean }, "statusCode": "string" } }, "operationName": "string", "requestModels": { "string" : "string" }, "requestParameters": { "string" : boolean }, "requestValidatorId": "string" } } }

Response Elements

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

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

id

The resource's identifier.

Type: String

parentId

The parent resource's identifier.

Type: String

path

The full path for this resource.

Type: String

pathPart

The last path segment for this resource.

Type: String

resourceMethods

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

Type: String to Method object map

Errors

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

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

Get an API resource of a given resource identifier

This example illustrates one usage of GetResource.

Sample Request

GET /restapis/fugvjdxtri/resources/3kzxbg5sa2 HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20170223T025309Z 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}

Sample Response

{ "_links": { "curies": [ { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-{rel}.html", "name": "method",c "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-resource-{rel}.html", "name": "resource", "templated": true } ], "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2" }, "method:by-http-method": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/{http_method}", "templated": true }, "method:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/{http_method}", "templated": true }, "resource:create-child": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2" }, "resource:methods": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET", "name": "GET", "title": "GET" }, "resource:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2" } }, "id": "3kzxbg5sa2", "path": "/" }

See Also

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