Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Mastering ASP.NET Web API
Mastering ASP.NET Web API

Mastering ASP.NET Web API: Build powerful HTTP services and make the most of the ASP.NET Core Web API platform

eBook
Mex$561.99 Mex$803.99
Paperback
Mex$1004.99
Subscription
Free Trial

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Mastering ASP.NET Web API

Understanding HTTP and REST

REST means Representational State Transfer. The REST architecture style was a PhD dissertation by Roy T. Fielding titled Architectural Styles and the Design of Network-based Software. This paper was first published in 2000 after a 6 year study. We can be thankful to Mr. Fielding for the research work and findings.

The modern-day API is modeled around REST, and you will hear people mentioning, it's not RESTful or questioned, is your API RESTful?

To create and model a well-defined API, you need to have sound knowledge of REST. For this reason, we will delve a bit deeper into Roy T. Fielding's study.

Roy T. Fielding set out to fix a few problems that showed their head in 1993. Many authors were publishing their work on the web, and they wanted to collaborate. The web became a great place to share and discuss research work. However, no sooner...

Software architecture

Software architecture is an abstraction of the runtime elements of a software system during a phase of its operation. A system may be composed of many levels of abstraction and many phases of operation, each with its own software architecture.

Software architecture is defined by a configuration of architectural elements-components, connectors, and data-constrained in their relationships in order to achieve a desired set of architectural properties:

  • Component: This is is an abstract unit of software instructions and the internal state that provides a transformation of data via its interface
  • Connector : This is an abstract mechanism that mediates communication, coordination, or cooperation among components
  • Data: This is an element of information that is transferred from a component, or received by a component, via its connector

The REST architectural style...

REST principles

REST is modeled around starting with nothing and then adding constraints. We will apply constraints to a software architecture, and your architecture will become RESTful.

Client - server

Note that throughout Roy T. Fielding's work, he does not mention that REST has to be applied to the HTTP protocol. In our case, a client server will be the browser as the client and IIS as the server.

Note that the separation of the client and server allows abstraction. These two components can be built independently as well as deployed independently.

Stateless

The...

REST architectural elements

As discussed earlier, REST is not a protocol, and it can be discussed without implementation. The key element of REST is the ability to add constraints to components, connectors, and data.

Data elements

When you select a hyperlink where data needs to be transferred from the server to the client, the client needs to interpret the data and render it into a format to the user. How does the REST principle do this? The REST components transfer the data as well as the metadata to the client, with instructions to help the client compose the resource that it has requested:

Data element

Modern web examples

Resource

The intended conceptual target of a hypertext reference

Resource identifier...

HTTP

HTTP stands for Hypertext Transfer Protocol. The very first version was 0.9; then came version 1.0.

The key difference between 1.0 and 1.1 is that the client makes a connection with the server and that connection is reused, whereas in HTTP 1.0, the connection is thrown away and for each request, a new connection is created. HTTP 1.1 is also derived by applying the REST constraints to 1.0.

A basic HTTP message is composed of a header and body.

When the client communicates with the server, it communicates via HTTP. The server responds to the client with messages and code.

HTTP/1.1 status codes

There is a broad range of status codes, which indicate to the client what has occurred with the request that has been processed...

Version 2 of HTTP

HTTP/2 is an optimization of HTTP 1.1. Many browsers already support HTTP/2; your Chrome browser does that already.

HTTP/2 is a combination of two specifications: Hypertext Transfer Protocol version 2 (RFC7540) and HPACK- Header Compression for HTTP2 (RFC7541).

When using HTTP/2 over Transport Layer Security (TLS), "h2" is used to indicate the protocol.

The "h2c" string is used when HTTP/2 is used over clear text TCP or when HTTP.1.1 upgrades.

An example of a GET request is as follows:

GET / HTTP/1.1
Host: server.example.com
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: <base64url encoding of HTTP/2 SETTINGS payload>

-RCF 7540 Section 3.2

This request is from a client that does not know whether HTTP/2 is supported. It makes a HTTP 1.1 request, but includes an upgrade field in the header, "h2c", and at least...

Binary messages

Messages are processed faster as they are in a binary format compared to text. Since they are in the native binary format over the wire, they don't need to translate from text to binary by the TCP protocol.

Header compression

As the web has evolved, more data is sent from the server to the client and from the client to the server. HTTP 1.1 does not compress header fields. HTTP works over TCP and a request is sent over this connection, where the headers are large and contain redundant data. TCP works on Slow Start implemented by a network congestion-avoidance algorithm, which places packets over the network. If the headers are compressed, more packets can be sent over the wire. HTTP/2 fixed this problem...

Richardson maturity model

The Richardson maturity model (RMM) was developed by Leonard Richardson. Commonly referred to as RMM, it is used to upgrade the standard of your API.

Level 0

This is your traditional soap-based web service or the XML-RPC service. It uses HTTP, but it has one method and one URI. This method is usually POST and will return a heavy dataset. I am sure all of us have worked with this type of web service or might encounter it at some point. The entire database as a dataset is wrapped in this output.

Level 1

Resources are exposed, but you still have...

Summary

We looked at the definition of REST and how REST is derived. When you look at the REST architecture, you should be able to depict it in three categories, as explained by Roy T. Fielding. One, the process view, describes how data flows from the client to the several components. Two, the connector view is specific to the exchanging of messages between components specific to resources and resource identification. Three, the data view of how the data that we referred to as representations is transmitted from the server to the client. It is very important to have a good understanding of the REST principles and that REST was applied to HTTP 1.0 in order to derive HTTP 1.1.

HTTP is a living example of the REST principles. Actions such as GET and POST are stateless, which is a principle of REST. The examples show how to construct an HTTP request and what the server sends back...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Get a comprehensive analysis of the latest specification of ASP.NET Core and all the changes to the underlying platform that you need to know to make the most of the web API
  • See an advanced coverage of ASP.NET Core Web API to create robust models for your data, create controllers, and handle routing and security
  • This book is packed with key theoretical and practical concepts that can be instantly applied to build professional applications using API with Angular 4, Ionic, and React

Description

Microsoft has unified their main web development platforms. This unification will help develop web applications using various pieces of the ASP.NET platform that can be deployed on both Windows and LINUX. With ASP.NET Core (Web API), it will become easier than ever to build secure HTTP services that can be used from any client. Mastering ASP.NET Web API starts with the building blocks of the ASP.NET Core, then gradually moves on to implementing various HTTP routing strategies in the Web API. We then focus on the key components of building applications that employ the Web API, such as Kestrel, Middleware, Filters, Logging, Security, and Entity Framework.Readers will be introduced to take the TDD approach to write test cases along with the new Visual Studio 2017 live unit testing feature. They will also be introduced to integrate with the database using ORMs. Finally, we explore how the Web API can be consumed in a browser as well as by mobile applications by utilizing Angular 4, Ionic and ReactJS. By the end of this book, you will be able to apply best practices to develop complex Web API, consume them in frontend applications and deploy these applications to a modern hosting infrastructure.

Who is this book for?

This book is for .Net developers who wants to Master ASP.NET Core (Web API) and have played around with previous ASP.NET Web API a little, but don’t have in-depth knowledge of it. You need to know Visual Studio and C#, and have some HTML, CSS, and JavaScript knowledge.

What you will learn

  • Acquire conceptual and hands-on knowledge of ASP.NET Core (MVC & Web API)
  • Learn about HTTP methods, the structure of HTTP content, internet media types, and how servers respond to HTTP requests and their associated HTTP codes
  • Explore middleware, filters, routing, and unit testing
  • Optimize Web API implementations
  • Develop a secure Web API interface
  • Deploy Web API projects to various platforms
  • Consume your web API in front end application based on Angular 4, Bootstrap, and Ionic
  • Implement and explore the current trends in service architecture
Estimated delivery fee Deliver to Mexico

Standard delivery 10 - 13 business days

Mex$149.95

Premium delivery 3 - 6 business days

Mex$299.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 11, 2017
Length: 330 pages
Edition : 1st
Language : English
ISBN-13 : 9781786463951
Vendor :
Microsoft
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Mexico

Standard delivery 10 - 13 business days

Mex$149.95

Premium delivery 3 - 6 business days

Mex$299.95
(Includes tracking information)

Product Details

Publication date : Aug 11, 2017
Length: 330 pages
Edition : 1st
Language : English
ISBN-13 : 9781786463951
Vendor :
Microsoft
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 3,650.97
C# 7.1 and .NET Core 2.0 ??? Modern Cross-Platform Development
Mex$1640.99
ASP.NET Core 2 and Angular 5
Mex$1004.99
Mastering ASP.NET Web API
Mex$1004.99
Total Mex$ 3,650.97 Stars icon
Banner background image

Table of Contents

13 Chapters
Introduction to Microservices and Service-Oriented Architecture Chevron down icon Chevron up icon
Understanding HTTP and REST Chevron down icon Chevron up icon
Anatomy of ASP.NET Core Web API Chevron down icon Chevron up icon
Controllers, Actions, and Models Chevron down icon Chevron up icon
Implementing Routing Chevron down icon Chevron up icon
Middleware and Filters Chevron down icon Chevron up icon
Perform Unit and Integration Testing Chevron down icon Chevron up icon
Web API Security Chevron down icon Chevron up icon
Integration with Database Chevron down icon Chevron up icon
Error Handling, Tracing, and Logging Chevron down icon Chevron up icon
Optimization and Performance Chevron down icon Chevron up icon
Hosting and Deployment Chevron down icon Chevron up icon
Modern Web Frontends Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.8
(4 Ratings)
5 star 0%
4 star 25%
3 star 25%
2 star 50%
1 star 0%
Amazon Customer Feb 20, 2018
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
It has provided effective knowledge for API development using Dotnet Core with C# programming language. It has very real examples.
Amazon Verified review Amazon
DNAunion Jan 07, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
I largely agree with the other reviewer, who gave 2 stars. The book claims to have an author - who should have reviewed his work himself - as well as a proofreader, and a reviewer, but it has many unclear sentences (without examples to help clarify), grammatical errors, and code errors. I am really starting to get fed up with Packt books.
Amazon Verified review Amazon
Thomas E. Hoke Jr. May 05, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
This is a frustrating book to try to work through. Many of the code examples are incomplete and do not compile. I spent a lot of time searching the web for solutions, and this definitely hampered me from learning the concepts as well as I should have. There are also a lot of misspellings and grammatical errors. Overall, the book seems sloppy and rushed. Not recommended.
Amazon Verified review Amazon
E. Anderson Aug 30, 2017
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
I do not recommend this book. While the authors themselves may have a firm grasp on the ins and outs of Web API, you can't tell it from the code inside the book or what's bundled in the download. I tried implementing the code using the examples in the book and from the download files while reading "Chapter 4:Controllers, Actions, and Models". Too much of the code and concepts necessary to complete the solution were left out of the chapter and what was in the download was different than shown in the book.I gave up and continued reading the book but my curiosity got the better of me when I got to "Chapter 9: Integration with Database". Again, the code shown in the book was incomplete (missing crucial pieces) while the download was significantly different from the published book. This happened with both the EF6 and EF Core sections.I continued reading on and, not having learned my lesson earlier, tried implementing the code for "Chapter 12: Hosting and Deployment". More of the same problems.In summary, if the authors can't be bothered to provide coherent examples in the book and complete solutions matching what's been written, I won't bother recommending it. And even though the code is available through GitHub, I'm not wasting my time correcting their mistakes.I also blame the reviewer(s) who should've easily caught these mistakes.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela