Amazon API Gateway REST API Reference

method:by-http-method

Gets the method (as a Method resource) on a specified API resource (as Resource resource) of the given HTTP method type.

HTTP Request

GET /restapis/<restapi_id>/resources/<resource_id>/methods/{http_method}

Template Variable

Response

Method

Remarks

Example: View the detailed information about the GET method on an API resource

Request

GET /restapis/uojnr9hd57/resources/0cjtch/methods/GET HTTP/1.1
Content-Type: application/json
Host: apigateway.us-east-1.amazonaws.com
Content-Length: 117
X-Amz-Date: 20160613T205752Z
Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160613/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
Response

The successful response returns a 200 OK status code and a payload similar to the following:

{
  "_links": {
    "curies": [
      {
        "href": "http://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-{rel}.html&quot;,
        "name": "integration",
        "templated": true
      },
      {
        "href": "http://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html&quot;,
        "name": "integrationresponse",
        "templated": true
      },
      {
        "href": "http://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-{rel}.html&quot;,
        "name": "method",
        "templated": true
      },
      {
        "href": "http://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-response-{rel}.html&quot;,
        "name": "methodresponse",
        "templated": true
      }
    ],
    "self": {
      "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET",
      "name": "GET",
      "title": "GET"
    },
    "integration:put": {
      "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration"
    },
    "method:delete": {
      "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET"
    },
    "method:integration": {
      "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration"
    },
    "method:responses": {
      "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200",
      "name": "200",
      "title": "200"
    },
    "method:update": {
      "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET"
    },
    "methodresponse:put": {
      "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/{status_code}",
      "templated": true
    }
  },
  "apiKeyRequired": false,
  "authorizationType": "NONE",
  "httpMethod": "GET",
  "requestParameters": {
    "method.request.querystring.operand2": false,
    "method.request.querystring.operator": false,
    "method.request.querystring.operand1": false
  },
  "_embedded": {
    "method:integration": {
      "_links": {
        "self": {
          "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration"
        },
        "integration:delete": {
          "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration"
        },
        "integration:responses": {
          "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200",
          "name": "200",
          "title": "200"
        },
        "integration:update": {
          "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration"
        },
        "integrationresponse:put": {
          "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/{status_code}",
          "templated": true
        }
      },
      "cacheKeyParameters": [],
      "cacheNamespace": "0cjtch",
      "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole",
      "httpMethod": "POST",
      "passthroughBehavior": "WHEN_NO_MATCH",
      "requestTemplates": {
        "application/json": "{\n    \"a\":  \"$input.params('operand1')\",\n    \"b\":  \"$input.params('operand2')\", \n    \"op\": \"$input.params('operator')\"   \n}"
      },
      "type": "AWS",
      "uri": "arn:aws:apigateway:us-west-2:lambda:path//2015-03-31/functions/arn:aws:lambda:us-west-2:123456789012:function:Calc/invocations",
      "_embedded": {
        "integration:responses": {
          "_links": {
            "self": {
              "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200",
              "name": "200",
              "title": "200"
            },
            "integrationresponse:delete": {
              "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200"
            },
            "integrationresponse:update": {
              "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200"
            }
          },
          "responseParameters": {
            "method.response.header.operator": "integration.response.body.op",
            "method.response.header.operand_2": "integration.response.body.b",
            "method.response.header.operand_1": "integration.response.body.a"
          },
          "responseTemplates": {
            "application/json": "#set($res = $input.path('$'))\n{\n    \"result\": \"$res.a, $res.b, $res.op => $res.c\",\n  \"a\" : \"$res.a\",\n  \"b\" : \"$res.b\",\n  \"op\" : \"$res.op\",\n  \"c\" : \"$res.c\"\n}"
          },
          "selectionPattern": "",
          "statusCode": "200"
        }
      }
    },
    "method:responses": {
      "_links": {
        "self": {
          "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200",
          "name": "200",
          "title": "200"
        },
        "methodresponse:delete": {
          "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200"
        },
        "methodresponse:update": {
          "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200"
        }
      },
      "responseModels": {
        "application/json": "Empty"
      },
      "responseParameters": {
        "method.response.header.operator": false,
        "method.response.header.operand_2": false,
        "method.response.header.operand_1": false
      },
      "statusCode": "200"
    }
  }
}

See Also

AWS CLI