2

I am learning AWS, and was deep diving into API Gateway. But what is not clear to me is the difference between resource and method in API Gateway. I got the idea that methods are a part of resource, and they are client facing. Whereas resources, are a broader category, that involves more. Would appreciate if someone, could help me identify the difference between them in a more easier and intuitive way. I have gone through the docs, and a few youtube videos on my end.

muditrustagii
  • 513
  • 4
  • 13

2 Answers2

6
  • Method is a GET, POST, DELETE, etc.
  • Resource is actual path of the url

Lets take a simple example:

  • GET /pet/{petId}
  • DELETE /pet/{petId}
  • PUT /pet/{petId}
  • POST /pet/{petId}
  • GET /pet/getAll

we need 3 resources

  1. /pet
  2. /pet/{petId}
  3. /pet/getAll

When defining them in Api Gateway, second and third resource goes underneath first resource as they are prefexed with /pet

and methods under each resource.

  1. /pet > No methods underneath
  2. /pet/{petId} > GET, POST, PUT, DELETE methods
  3. /pet/getAll > GET method

Will look something like this:

enter image description here

Balu Vyamajala
  • 7,163
  • 1
  • 8
  • 26
1
  • Resource - the actual endpoints which we are creating excluding the default url
  • Method - HTTP methods (GET, PUT, POST, DELETE) inside the resource(Endpoints)

The hierarchy can be like

enter image description here

enter image description here

In this image black box are resource and red are methods

Hari Prasath
  • 190
  • 3
  • 6