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.
Asked
Active
Viewed 1,025 times
2 Answers
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
- /pet
- /pet/{petId}
- /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.
- /pet > No methods underneath
- /pet/{petId} > GET, POST, PUT, DELETE methods
- /pet/getAll > GET method
Will look something like this:
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
In this image black box are resource and red are methods
Hari Prasath
- 190
- 3
- 6