Designing Evolvable Web APIs with ASP.NET - Helion
ISBN: 978-14-493-3789-6
stron: 538, Format: ebook
Data wydania: 2014-03-13
Księgarnia: Helion
Cena książki: 118,15 zł (poprzednio: 137,38 zł)
Oszczędzasz: 14% (-19,23 zł)
Design and build Web APIs for a broad range of clients—including browsers and mobile devices—that can adapt to change over time. This practical, hands-on guide takes you through the theory and tools you need to build evolvable HTTP services with Microsoft’s ASP.NET Web API framework. In the process, you’ll learn how design and implement a real-world Web API.
Ideal for experienced .NET developers, this book’s sections on basic Web API theory and design also apply to developers who work with other development stacks such as Java, Ruby, PHP, and Node.
- Dig into HTTP essentials, as well as API development concepts and styles
- Learn ASP.NET Web API fundamentals, including the lifecycle of a request as it travels through the framework
- Design the Issue Tracker API example, exploring topics such as hypermedia support with collection+json
- Use behavioral-driven development with ASP.NET Web API to implement and enhance the application
- Explore techniques for building clients that are resilient to change, and make it easy to consume hypermedia APIs
- Get a comprehensive reference on how ASP.NET Web API works under the hood, including security and testability
Osoby które kupowały "Designing Evolvable Web APIs with ASP.NET", wybierały także:
- Gray Hat C#. Język C# w kontroli i łamaniu zabezpieczeń 57,74 zł, (17,90 zł -69%)
- ASP.NET Core 6. Kurs video. Rozwijaj aplikacje webowe z Entity Framework Core 179,00 zł, (71,60 zł -60%)
- Testowanie automatyczne w .NET. Kurs video. Zastosowania frameworka nUnit 169,00 zł, (76,05 zł -55%)
- Programowanie asynchroniczne i równoległe w C#. Kurs video. Poziom podstawowy 69,00 zł, (31,05 zł -55%)
- Technologia LINQ. Kurs video. Warsztat pracy z danymi z różnych źródeł 59,00 zł, (26,55 zł -55%)
Spis treści
Designing Evolvable Web APIs with ASP.NET eBook -- spis treści
- Designing Evolvable Web APIs with ASP.NET
- Foreword
- Preface
- Why Should You Read This Book?
- What Do You Need to Know to Follow Along?
- The Hitchhikers Guide to Navigating This Book
- Part I, Fundamentals
- Part II, Real-World API Development
- Part III, Web API Nuts and Bolts
- Conventions Used in This Book
- Using Code Examples
- Safari Books Online
- How to Contact Us
- Acknowledgments
- 1. The Internet, the World Wide Web, and HTTP
- Web Architecture
- Resource
- URI
- Cool URIs
- Representation
- Media Type
- Media type registration
- HTTP
- Moving Beyond HTTP 1.1
- HTTP Message Exchange
- Intermediaries
- Types of Intermediaries
- HTTP Methods
- Conditional requests
- Method properties
- Headers
- HTTP Status Codes
- Content Negotiation
- Caching
- Expiration
- Validation
- Invalidation
- ETags
- Caching and negotiated responses
- Cache behaviors
- Authentication
- Authentication Schemes
- Additional Authentication Schemes
- Conclusion
- Web Architecture
- 2. Web APIs
- What Is a Web API?
- What About SOAP Web Services?
- Origins of Web APIs
- The Web API Revolution Begins
- Paying Attention to the Web
- Guidelines for Web APIs
- Domain-Specific Media Types
- Media Type Profiles
- Multiple Representations
- API Styles
- The Richardson Maturity Model
- RPC (RMM Level 0)
- Resources (RMM Level 1)
- HTTP VERBS (RMM Level 2)
- Crossing the Chasm Toward Resource-Centric APIs
- Hypermedia (RMM Level 3)
- REST
- REST Constraints
- Conclusion
- 3. ASP.NET Web API 101
- Core Scenarios
- First-Class HTTP Programming
- Symmetric Client and Server Programming Experience
- Flexible Support for Different Formats
- No More Coding with Angle Brackets
- Unit Testability
- Multiple Hosting Options
- Getting Started with ASP.NET Web API
- Exploring a New Web API Project
- WebApiConfig
- ValuesController
- Hello Web API!
- Creating the Service
- A read-only greeting service
- Content negotiation
- Add a greeting
- Handling errors
- Testing the API
- The Client
- The Host
- Creating the Service
- Conclusion
- Core Scenarios
- 4. Processing Architecture
- The Hosting Layer
- Message Handler Pipeline
- Route Dispatching
- Controller Handling
- The ApiController Base Class
- Parameter binding
- Conversion into an HttpResponseMessage
- Filters
- The ApiController Base Class
- Conclusion
- 5. The Application
- Why Evolvable?
- Barriers to Evolution
- What Is the Cost?
- Why Not Just Version?
- Payload-based versioning
- Versioning the media type
- Versioning in the URL
- Walking the Walk
- Application Objectives
- Goals
- Opportunity
- Information Model
- Subdomains
- Descriptive
- Categorization
- Current state
- Historical
- Related Resources
- Attribute Groups
- Collections of Attribute Groups
- Information Model Versus Media Type
- Collections of Issues
- Subdomains
- Resource Models
- Root Resource
- Search Resources
- Collection Resources
- Item Resources
- Conclusion
- Why Evolvable?
- 6. Media Type Selection and Design
- Self-Description
- Types of Contracts
- Media Types
- Primitive Formats
- Popular Formats
- New Formats
- Hypermedia Types
- Media Type Explosion
- Generic Media Types and Profiles
- Other Hypermedia Types
- Collection+Json
- Siren
- Link Relation Types
- Semantics
- Replacing Embedded Resources
- Indirection Layer
- Reference Data
- Workflow
- Syntax
- A Perfect Combination
- Designing a New Media Type Contract
- Selecting a Format
- Enabling Hypermedia
- Optional, Mandatory, Omitted, Applicable
- Embedded Versus External Metadata
- Extensibility
- Registering the Media Type
- Designing New Link Relations
- Standard Link Relations
- Extension Link Relations
- Embedded Link Relations
- Registering the Link Relation
- Media Types in the Issue Tracking Domain
- List Resources
- Item Resources
- Discovery Resource
- Search Resource
- Conclusion
- 7. Building the API
- The Design
- Getting the Source
- Building the Implementation Using BDD
- Navigating the Solution
- Packages and Libraries
- Self-Host
- Models and Services
- Issue and Issue Store
- IssueState
- IssuesState
- Link
- IssueStateFactory
- LinkFactory
- IssueLinkFactory
- Acceptance Criteria
- Feature: Retrieving Issues
- Retrieving an Issue
- Understanding the tests
- Retrieving Open and Closed Issues
- Retrieving an Issue That Does Not Exist
- Retrieving All Issues
- Retrieving All Issues as Collection+Json
- Searching Issues
- Retrieving an Issue
- Feature: Creating Issues
- Feature: Updating Issues
- Updating an Issue
- Updating an Issue That Does Not Exist
- Feature: Deleting Issues
- Deleting an Issue
- Deleting an Issue That Does Not Exist
- Feature: Processing Issues
- The Tests
- The Implementation
- Conclusion
- 8. Improving the API
- Acceptance Criteria for the New Features
- Implementing the Output Caching Support
- Adding the Tests for Output Caching
- Implementing Cache Revalidation
- Implementing Conditional GETs for Cache Revalidation
- Conflict Detection
- Implementing Conflict Detection
- Change Auditing
- Implementing Change Auditing with Hawk Authentication
- Tracing
- Implementing Tracing
- Conclusion
- 9. Building the Client
- Client Libraries
- Wrapper Libraries
- Reliability
- Response types
- Lifetime
- Everyone has his or her own style
- Hypermedia hostile
- Links as Functions
- Service antipattern
- Deserializing links
- Separating request and response
- Links as bookmarks
- Wrapper Libraries
- Application Workflow
- Need to Know
- Handle all the versions
- Change is inevitable
- Clients with Missions
- Client State
- Need to Know
- Conclusion
- Client Libraries
- 10. The HTTP Programming Model
- Messages
- Headers
- Message Content
- Consuming Message Content
- Creating Message Content
- Content length and streaming
- Custom content classes
- Conclusion
- 11. Hosting
- Web Hosting
- The ASP.NET Infrastructure
- Applications
- Modules
- Handlers
- ASP.NET Routing
- Web API Routing
- Global Configuration
- The Web API ASP.NET Handler
- The ASP.NET Infrastructure
- Self-Hosting
- WCF Architecture
- The HttpSelfHostServer Class
- The HttpSelfHostConfiguration Class
- URL Reservation and Access Control
- Hosting Web API with OWIN and Katana
- OWIN
- The Katana Project
- Web API Configuration
- Web API Middleware
- The OWIN Ecosystem
- In-Memory Hosting
- Azure Service Bus Host
- Conclusion
- Web Hosting
- 12. Controllers and Routing
- HTTP Message Flow Overview
- The Message Handler Pipeline
- Dispatcher
- HttpControllerDispatcher
- Controller Selection
- Supporting attribute-based routes
- Plugging in a custom controller selector
- Controller Activation
- The Controller Pipeline
- ApiController
- ApiController Processing Model
- Action selection
- Filters
- Authentication filters
- Authorization filters
- Action filters
- Exception filters
- Model binding and validation
- Action invocation
- Conclusion
- 13. Formatters and Model Binding
- The Importance of Models in ASP.NET Web API
- How Model Binding Works
- Built-In Model Binders
- The ModelBindingParameterBinder Implementation
- Value Providers
- Model Binders
- Model Binding Against URIs Only
- The FormatterParameterBinder Implementation
- Default HttpParameterBinding Selection
- Model Validation
- Applying Data Annotation Attributes to a Model
- Querying the Validation Results
- Conclusion
- 14. HttpClient
- HttpClient Class
- Lifecycle
- Wrapper
- Multiple Instances
- Thread Safety
- Helper Methods
- Peeling Off the Layers
- Completed Requests Dont Throw
- Content Is Everything
- Cancelling the Request
- SendAsync
- Client Message Handlers
- Proxying Handlers
- Fake Response Handlers
- Creating Resuable Response Handlers
- Conclusion
- HttpClient Class
- 15. Security
- Transport Security
- Using TLS in ASP.NET Web API
- Using TLS with IIS Hosting
- Using TLS with Self-Hosting
- Authentication
- The Claims Model
- Retrieving and Assigning the Current Principal
- Transport-Based Authentication
- Server Authentication
- Client Authentication
- The HTTP Authentication Framework
- Implementing HTTP-Based Authentication
- Katana Authentication Middleware
- Active and Passive Authentication Middleware
- Web API Authentication Filters
- Token-Based Authentication
- The Hawk Authentication Scheme
- Authorization
- Authorization Enforcement
- Cross-Origin Resource Sharing
- CORS Support on ASP.NET Web API
- Conclusion
- 16. The OAuth 2.0 Authorization Framework
- Client Applications
- Accessing Protected Resources
- Obtaining Access Tokens
- Authorization Code Grant
- Scope
- Front Channel Versus Back Channel
- Refresh Tokens
- Resource Server and Authorization Server
- Processing Access Tokens in ASP.NET Web API
- OAuth 2.0 and Authentication
- Scope-Based Authorization
- Conclusion
- 17. Testability
- Unit Tests
- Unit Testing Frameworks
- Getting Started with Unit Testing in Visual Studio
- xUnit.NET
- Unit test organization
- The Assert class
- The Role of Unit Testing in Test-Driven Development
- The red and green cycle
- Code refactoring
- Dependency injection and mocking
- Unit Testing an ASP.NET Web API Implementation
- Unit Testing an ApiController
- Testing the Get method
- Testing the Post method
- IHttpActionResult in Web API 2
- Unit Testing a MediaTypeFormatter
- Unit Testing an HttpMessageHandler
- Unit Testing an ActionFilterAttribute
- Unit Testing an ApiController
- Unit Testing Routes
- Integration Tests in ASP.NET Web API
- Conclusion
- Unit Tests
- A. Media Types
- B. HTTP Headers
- C. Content Negotiation
- Proactive Negotiation
- Reactive Negotiation
- D. Caching in Action
- E. Authentication Workflows
- F. Media Type Specification for application/issue+json
- Notational Conventions
- Issue Documents
- Security Considerations
- Interoperability Considerations
- IANA Considerations
- G. Public-Key Cryptography and Certificates
- Revocation
- Creating Test Keys and Certificates
- Index
- Colophon
- Copyright