Tìm kiếm tài liệu miễn phí

Ebook RESTful Service Best Practices

Ebook RESTful Service Best Practices. What is REST, REST Quick Tips, definitions, HTTP Verbs, resource Naming, Returning, Representations, querying, filtering and Pagination.



Đánh giá tài liệu

0 Bạn chưa đánh giá, hãy đánh giá cho tài liệu này


  • 5 - Rất hữu ích 0

  • 4 - Tốt 0

  • 3 - Trung bình 0

  • 2 - Tạm chấp nhận 0

  • 1 - Không hữu ích 0

Mô tả

RESTful Service Best Practices

RESTful Service Best Practices
Recommendations for Creating Web Services

Todd Fredrich
Pearson eCollege
@tfredrich
www.RestApiTutorial.com

08/02/13

www.RestApiTutorial.com

Page 1 of 40

RESTful Service Best Practices

08/02/13

www.RestApiTutorial.com

Page 2 of 40

RESTful Service Best Practices

Table of Contents
Document History...................................................................................................................................... 5
Who Should Read This Document.............................................................................................................5
Introduction................................................................................................................................................ 6
What is REST?...........................................................................................................................................6
Uniform Interface.................................................................................................................................. 7
Resource-Based................................................................................................................................ 7
Manipulation of Resources Through Representations......................................................................7
Self-descriptive Messages................................................................................................................ 7
Hypermedia as the Engine of Application State (HATEOAS)......................................................... 7
Stateless................................................................................................................................................. 7
Cacheable.............................................................................................................................................. 8
Client–server......................................................................................................................................... 8
Layered system......................................................................................................................................8
Code on demand (optional)................................................................................................................... 8
REST Quick Tips....................................................................................................................................... 9
Use HTTP Verbs to Mean Something................................................................................................... 9
Sensible Resource Names..................................................................................................................... 9
XML and JSON..................................................................................................................................... 9
Create Fine-Grained Resources...........................................................................................................10
Consider Connectedness......................................................................................................................10
Definitions................................................................................................................................................10
Idempotence........................................................................................................................................ 10
Safety................................................................................................................................................... 11
HTTP Verbs.............................................................................................................................................. 11
GET..................................................................................................................................................... 11
PUT..................................................................................................................................................... 12
POST................................................................................................................................................... 12
PUT vs POST for Creation..................................................................................................................13
DELETE..............................................................................................................................................13
Resource Naming..................................................................................................................................... 14
Resource URI Examples..................................................................................................................... 15
Resource Naming Anti-Patterns.......................................................................................................... 16
Pluralization.........................................................................................................................................16
Returning Representations....................................................................................................................... 17
Resource Discoverability Through Links (HATEOAS cont'd)........................................................... 18
Minimal Linking Recommendations.............................................................................................. 19
Link Format.................................................................................................................................... 19
Wrapped Responses.............................................................................................................................21
Handling Cross-Domain Issues........................................................................................................... 22
Supporting CORS........................................................................................................................... 22
Supporting JSONP..........................................................................................................................22
Querying, Filtering and Pagination.......................................................................................................... 23
Limiting Results.................................................................................................................................. 24
08/02/13

www.RestApiTutorial.com

Page 3 of 40

RESTful Service Best Practices
Limiting via the Range Header.......................................................................................................25
Limiting via Query-String Parameters............................................................................................25
Range-Based Responses................................................................................................................. 25
Pagination............................................................................................................................................26
Filtering and Sorting Results...............................................................................................................27
Filtering.......................................................................................................................................... 27
Sorting............................................................................................................................................ 28
Service Versioning................................................................................................................................... 28
Support Versioning via Content Negotiation.......................................................................................29
What version is returned when no version is specified?.................................................................31
Unsupported Versions Requested................................................................................................... 31
When Should I Create a New Version?............................................................................................... 32
Changes that will break contracts................................................................................................... 32
Changes considered non-breaking..................................................................................................33
At What Level Should Versioning Occur?.......................................................................................... 33
Use Content-Location to Enhance Responses.....................................................................................33
Links with Content-Type.....................................................................................................................33
Finding Out What Versions are Supported.......................................................................................... 33
How many versions should I support at once?............................................................................... 33
Deprecated...................................................................................................................................... 33
How do I inform clients about deprecated resources?....................................................................34
Date/Time Handling.................................................................................................................................34
Date/Time Serialization In Body Content........................................................................................... 34
Date/Time Serialization In HTTP Headers..........................................................................................35
Securing Services..................................................................................................................................... 35
Authentication..................................................................................................................................... 35
Transport Security............................................................................................................................... 36
Authorization.......................................................................................................................................36
Application Security............................................................................................................................36
Caching and Scalability........................................................................................................................... 37
The ETag Header............................................................................................................................ 37
HTTP Status Codes (Top 10)................................................................................................................... 39
Additional Resources............................................................................................................................... 40
Books...................................................................................................................................................40
Websites...............................................................................................................................................40

08/02/13

www.RestApiTutorial.com

Page 4 of 40

RESTful Service Best Practices

Document History
Date

Version

Description

Feb 10, 2012

Draft

Initial draft version.

Apr 24, 2012

v1.0

Initial public (non-draft) version.

May 29, 2012

v1.1

Minor updates to correct misspellings and clarify wording after
feedback from API Best Practices Task force.

Aug 2, 2013

v1.2

Updated versioning section. Additional minor corrections of
misspellings, wording, etc.

Who Should Read This Document
This best-practices document is intended for developers who are interested in creating RESTful Web
services that provide high reliability and consistency across multiple service suites. By following these
guidelines, services are well positioned for rapid, widespread, public adoption by both internal and
external clients.
The guidelines in this document are also appropriate for support engineers where they desire to services
developed using these best practices. While their concerns may be focused on caching practices, proxy
rules, monitoring, security and such, this document may be useful as an overarching service
documentation guide of sorts.
Additionally, management personnel may benefit from these guidelines by endeavoring to understand
the effort required to create services that are publicly consumable and offer high levels of consistency
across their service suites.

08/02/13

www.RestApiTutorial.com

Page 5 of 40

Tài liệu cùng danh mục Quản trị mạng

Lecture CCNA Exploration 4.0 (Kỳ 4) - Chapter 7: Implementing IP Addressing Services

The following will be discussed in this chapter: Configure DHCP in an enterprise branch network, Configure NAT on a Cisco router, Configure new generation RIP (RIPng) to use IPv6. Every device that connects to a network needs an IP address. Network administrators assign static IP addresses to routers, servers, and other network devices whose locations (physical and logical) are not likely to change.


MIDDLEWARE NETWORKS- P8

MIDDLEWARE NETWORKS- P8: The material in this book is presented in three major parts: IP Technology Fundamentals, IP Service Platform Fundamentals, and Building the IP Platform. Part I of IP Technology Fundamentals presents key technologies and issues that lay the foundation for building IP service platforms.


Thư rác tấn công mạnh vào mạng xã hội

Twitter đang là nguồn tin tức cập nhật nhanh nhất cho hàng triệu người dùng Internet khi tin tức được lan truyền trên mạng. Trong khi đại đa số người dùng cá nhân sử dụng dịch vụ này thì các doanh nghiệp phải thường xuyên đào tạo cho nhân viên của họ, cũng là người dùng Twitter, để đảm bảo rằng nguồn tin từ đó phải đáng tin cậy, nhưng trên Twitter, xác định được điều đó khá khó khăn. Cũng như nhiều trang mạng xã hội khác, Twitter cũng là mục tiêu tấn công của các hoạt động mã độc....


Internetworking with TCP/IP- P79

Internetworking with TCP/IP- P79: TCP/IP has accommodated change well. The basic technology has survived nearly two decades of exponential growth and the associated increases in traffic. The protocols have worked over new high-speed network technologies, and the design has handled applications that could not be imagined in the original design. Of course, the entire protocol suite has not remained static. New protocols have been deployed, and new techniques have been developed to adapt existing protocols to new network technologies....


Networking Theory and Fundamentals - Lecture 2

Tham khảo tài liệu 'networking theory and fundamentals - lecture 2', công nghệ thông tin, quản trị mạng phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả


The Practice of Internet Counseling

The delivery of technology-assisted distance counseling continues to grow and evolve. Technology assistance in the form of computer-assisted assessment, computer-assisted information systems, and telephone counseling has been available and widely used for some time. The rapid development and use of the Internet to deliver information and foster communication has resulted in the creation of new forms of counseling. Developments have occurred so rapidly that it is difficult to communicate a common understanding of these new forms of counseling practice. The purpose of this document is to create standard definitions of technology-assisted distance counseling that can be easily updated in response to evolutions in technology and practice. A definition of...


Giáo trình hướng dẫn phân tích dịch vụ của các nhà cung cấp internet ISP p7

Copernic.com là một ví dụ tiêu biểu về công cụ tìm kiếm dạng Meta. 15. Cần nhớ rằng các công cụ tìm kiếm không đánh dấu hết tất cả văn bản có trên web. Ví dụ chúng không thể đánh dấu các trang được bảo vệ bằng mật khẩu, các trang nằm bên trong tường lửa hay các trang đã được lập trình để tránh các đánh dấu của công cụ tìm kiếm.


Beginning Zend Framework phần 5

Xác định mức độ thường xuyên thu gom rác thải là chạy (mặc định là 1 / ). Thiết lập phông chữ sử dụng. Thiết lập kích thước phông chữ sử dụng. Thiết lập chiều cao hình ảnh được sử dụng cho CAPTCHA. Thiết lập chiều rộng của hình ảnh được sử dụng cho CAPTCHA.


Đề thi về mạng máy tính

- Đổi tên máy tính thành PC_SoMay_Ten. Trong đó, SoMay là số máy ngồi, Ten là tên của thí sinh. - Đặt địa chỉ IP máy là 192.168.4.SoMay (SoMay chỉ lấy 2 số cuối), Subnet Mark là: 255.255.255.0


RTSP 2.0 Asynchronous Notification draft-stiemerling-rtsp-announce-01

Some IPTV deployments that are using the Real Time Streaming Protocol (RTSP) require the ability of the server to notify clients about asynchronous events occurring during an RTSP session. Such asynchronous events are, for example, end of session, end of stream or change (redirect) of the RTSP server. While redirecting RTSP clients to a different RTSP server is well-described in RTSP 1.0 [RFC2326] and RTSP 2.0 [I-D.ietf-mmusic-rfc2326bis], end of stream or end of session by the server is not defined. This memo aims at changing RTSP 2.0 but not RTSP 1.0. Some RTSP 1.0 deployments are extending the ANNOUNCE method of [RFC2326], which is defined as: When sent from client to...


Tài liệu mới download

Machine Learning cơ bản
  • 18/04/2017
  • 33.490
  • 418

Từ khóa được quan tâm

Có thể bạn quan tâm

Module 2 - MÔ HÌNH OSI VÀ TCP/IP
  • 14/11/2010
  • 28.763
  • 436
MCSA Lab6
  • 26/03/2011
  • 18.417
  • 841
Cracking part 42
  • 14/09/2010
  • 57.611
  • 112

Bộ sưu tập

Danh mục tài liệu