REST API
Definition
Representational State Transfer Application Programming Interface (REST API)
A REST API is an API based on the REST architecture.
Components of a REST API
1. URIs should use nouns rather than verbs and should be in lowercase.
Bad Example | http://eunhanspace.blogspot.com/Running/ |
---|---|
Good Example | http://eunhanspace.blogspot.com/run/ |
2. URIs should not end with a slash (/).
Bad Example | http://eunhanspace.blogspot.com/test/ |
---|---|
Good Example | http://eunhanspace.blogspot.com/test |
3. Hyphens should be used instead of underscores.
Bad Example | http://eunhanspace.blogspot.com/hello_world |
---|---|
Good Example | http://eunhanspace.blogspot.com/hello-world |
4. File extensions should not be included in URIs.
Bad Example | http://eunhanspace.blogspot.com/photo.jpg |
---|---|
Good Example | http://eunhanspace.blogspot.com/photo |
5. Actions should not be included in URIs.
Bad Example | http://eunhanspace.blogspot.com/create-post/1 |
---|---|
Good Example | http://eunhanspace.blogspot.com/post/1 |
RESTful API
Definition
RESTful refers to a system that follows the principles of REST. However, not all systems that use REST are RESTful.
A system can be considered RESTful if it follows the design rules of a REST API, and an API that performs all CRUD functions with POST or an API that does not follow the URI rules of a REST API can be considered a REST API but not RESTful.
댓글 없음:
댓글 쓰기