Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
RESTful 
API 
Design 
Fundamentals
Resource 
URI 
Representat 
ions 
HTTP Verbs Resources
Resource 
Any object associated with data, identified with 
URI, and can be operated by using HTTP 
methods
Collection(customers) Singleton(customer) 
/articles /articles/{articleI 
d}
Sub-collections 
/articles/{articleId}/comments 
/articles/{articleId}/comments/{commentId} (Sub-collection 
resource)
Http Verbs 
Article Create 
Article Update 
Article Delete
GET -> show 
POST -> create 
PUT -> update 
DELETE -> delete
Representation 
XML 
JSON
Resource URI 
Unique Resource Identifier
Choosing Resource 
Analyze your business domain 
Define your needs 
Consumer needs important
Fine Grained Resource 
Multiple API request (title, content, slug, etc...)
Coarse Grained Resource 
All the details at once. 
Send Article data to API
Business logic on consumer side 
First create article content 
Attach category (mandatory) 
If user does not add category,...
…. 
On every update on API side will reflect to 
consumer side
Action A depends on; 
Resource A 
Resource B 
Resource C
Then Action A can be defined as; 
Resource X
Versioning 
Url shouldn’t contain version 
http://yourdomain.com/api/v3.0/articles/123 
(Bad)
… instead 
Version in the header 
GET /articles/123 
Accept: 
application/vnd.huseyinbabal.blogging.article-v3+ 
json
Even worse 
http://yourdomain.com/api/v3.0/articles/v2.5/co 
mments/v1.7/likes
RESTful API Design Fundamentals
Upcoming SlideShare
Loading in …5
×

1

Share

Download to read offline

RESTful API Design Fundamentals

Download to read offline

RESTful API Design Fundamentals

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

RESTful API Design Fundamentals

  1. 1. RESTful API Design Fundamentals
  2. 2. Resource URI Representat ions HTTP Verbs Resources
  3. 3. Resource Any object associated with data, identified with URI, and can be operated by using HTTP methods
  4. 4. Collection(customers) Singleton(customer) /articles /articles/{articleI d}
  5. 5. Sub-collections /articles/{articleId}/comments /articles/{articleId}/comments/{commentId} (Sub-collection resource)
  6. 6. Http Verbs Article Create Article Update Article Delete
  7. 7. GET -> show POST -> create PUT -> update DELETE -> delete
  8. 8. Representation XML JSON
  9. 9. Resource URI Unique Resource Identifier
  10. 10. Choosing Resource Analyze your business domain Define your needs Consumer needs important
  11. 11. Fine Grained Resource Multiple API request (title, content, slug, etc...)
  12. 12. Coarse Grained Resource All the details at once. Send Article data to API
  13. 13. Business logic on consumer side First create article content Attach category (mandatory) If user does not add category, then what?
  14. 14. …. On every update on API side will reflect to consumer side
  15. 15. Action A depends on; Resource A Resource B Resource C
  16. 16. Then Action A can be defined as; Resource X
  17. 17. Versioning Url shouldn’t contain version http://yourdomain.com/api/v3.0/articles/123 (Bad)
  18. 18. … instead Version in the header GET /articles/123 Accept: application/vnd.huseyinbabal.blogging.article-v3+ json
  19. 19. Even worse http://yourdomain.com/api/v3.0/articles/v2.5/co mments/v1.7/likes
  • liuorangle

    Jul. 4, 2017

RESTful API Design Fundamentals

Views

Total views

1,587

On Slideshare

0

From embeds

0

Number of embeds

7

Actions

Downloads

30

Shares

0

Comments

0

Likes

1

×