Skip to main content

Instructor-led training

ASP.NET Web API Essentials Using C# Training in Macomb, Illinois

This course provides a practical hands-on introduction to developing and consuming ASP.NET Web API services using C# and Visual Studio 2017.

What you'll learn

This course provides a practical hands-on introduction to developing and consuming ASP.NET Web API services using C# and Visual Studio 2017. This Web development framework from Microsoft makes it easy to create HTTP services that can reach a broad range of clients. It is an excellent platform for creating RESTful Web applications.

Private Training for Teams

This course is offered as private, instructor-led training for organizations, onsite in Macomb, Illinois or live online. Dates, delivery format, and course content are arranged around your team's requirements.

This course is not currently scheduled as a public class for individual enrollment.

Request Group Training

Prerequisites

The student should have a good working knowledge of C# and the .NET Framework. Basic knowledge of ASP.NET, HTML and JavaScript is also required.

Course Outline

1.      Introduction to ASP.NET Web API
 
ASP.NET Web API
Representational State Transfer
REST and Web API
HTTP Services Using Web API
Using Fiddler
Web API vs. WCF
 
2.      Web API and HTTP
 
HTTP Response Codes
HttpResponseException
Implementing POST
Implementing PUT
Implementing DELETE
 
3.      Media Formatters and Content Negotiation
 
Internet Media Types
Media Formatters
JSON and XML Formatters
Content Negotiation
Accept and Content-Type Headers
Using the Query String
Custom Request Headers
Serialization
BSON Serialization
 
4.      JavaScript Clients
 
Document Object Model
jQuery
Sending AJAX Requests
Implementing a Client
 
5.      Binding, Validation and Routing
 
Reading Raw HTTP Requests
Route Data, Query String and Request Body
Binding to Simple Types
Binding to Complex Types
Validation Using Data Annotations
Routing in ASP.NET Web API
Using Default Routes
 
6.      .NET Clients
 
Web API Client Libraries
HttpClient
Issuing GET Requests
Issuing POST Requests
Other Requests
 
Appendix A. Learning Resources

What makes Web API harder than it looks

Participants already write C#, so the language is not the obstacle. The difficulty is that a Web API service is a thin layer over HTTP, and most bugs come from not knowing what HTTP is doing between the client and your action method. The syllabus builds in a deliberate order.

  • HTTP first. The course opens with REST, how it maps onto Web API, and a comparison with WCF. It uses Fiddler to inspect traffic. It then covers response codes, HttpResponseException, and implementing POST, PUT and DELETE. A common misconception is that a service which returns data is finished. Clients depend on the right status code and on predictable behavior for each verb.
  • Content negotiation. Media formatters, the Accept and Content-Type headers, query-string and custom-header negotiation, and JSON, XML and BSON serialization all work together. Many developers assume the format is fixed by the code. In fact it is negotiated per request, so a service can behave differently for two clients.
  • Binding, validation and routing. Web API decides whether a parameter comes from route data, the query string or the request body. It does this by type: simple types and complex types follow different defaults. Data-annotation validation and default routes add further conventions. Binding that silently produces null or default values is a frequent source of confusion.
  • Two kinds of client. A JavaScript client (DOM, jQuery, AJAX requests) and a .NET client built on HttpClient consume the same service. Writing both shows how much of the design belongs to the contract and how much to either client.

Who it suits and what to take around it

This is a two-day introductory course. It suits C# developers who already have a good working knowledge of C# and the .NET Framework, plus basic ASP.NET, HTML and JavaScript. It fits teams that need to build HTTP services, or consume them from browser and .NET code. It also suits training managers who want a group working from the same REST vocabulary.

The course uses Visual Studio 2017, which is in extended support until April 2027. It is a good match for organizations that build or maintain services in that environment. Teams on newer releases can ask about a tailored private training proposal aligned to the versions they use.

The JavaScript module covers jQuery and AJAX requests. Developers who want broader browser-side work in ASP.NET can look at ASP.NET Ajax Using C#, which is a longer course in the same category. The Ajax learning guide shows how the related courses fit together.

Illustrative scenarios

The scenarios below are illustrations of how the course material can be applied. They are not descriptions of specific organizations or of the course's lab exercises.

  • A team exposing a record-keeping service. A team might publish create, read, update and delete operations for an internal data set. The work maps to implementing POST, PUT and DELETE, choosing response codes, and raising HttpResponseException for failures. Data-annotation validation would reject bad input before it reaches the data layer.
  • A service with mixed consumers. For example, one service may need to answer an older client that expects XML and a newer one that expects JSON. Content negotiation, the Accept header, custom request headers and the JSON and XML formatters apply directly. BSON serialization is an option where compact payloads matter.
  • One API, two front ends. A team might serve a browser page that uses jQuery AJAX calls and a .NET application that uses HttpClient for GET and POST requests. Testing both against the same routes shows where the API contract is ambiguous.

AI coding assistants with Web API code

AI coding assistants are good at scaffolding. They can draft controller actions, simple DTOs, data-annotation attributes and basic HttpClient calls quickly. Verify the results against the specific topics in this course.

  • Status codes and verbs. Generated actions often return 200 for everything or mishandle PUT and DELETE semantics. Check each action with Fiddler or a similar tool and compare the actual codes and headers to what you intended.
  • Binding and routing. Assistants can pick the wrong parameter source, or produce routes that conflict with the default route. Send requests through route data, the query string and the body, and confirm each value arrives populated.
  • Content negotiation. Generated code may hard-code JSON or ignore the Accept header. Test with different Accept and Content-Type values.
  • Client code and async. Generated HttpClient code may block on asynchronous calls or leave resources undisposed. Both are known causes of deadlocks and leaks in .NET. Review it for those patterns.
  • API existence. Assistants may suggest classes or attributes from a different framework generation than the one in your project. Compile against the targeted framework and check the documentation for anything unfamiliar.

Frequently asked questions

What level is this course?

It is introductory and runs two days. It is hands-on, but it assumes you already program in C#.

What should I know before attending?

A good working knowledge of C# and the .NET Framework, plus basic ASP.NET, HTML and JavaScript. The JavaScript module uses jQuery and the DOM to send AJAX requests.

What does the course cover?

REST and Web API, HTTP response codes and the POST, PUT and DELETE verbs, media formatters and content negotiation, JavaScript clients, binding, validation and routing, and .NET clients built with HttpClient.

Can it be delivered privately for our team?

Yes. HSG provides private training for organizations, onsite at the client's location or live online.

Can the content be customized, for example for the versions we use?

Private training can be tailored to an organization's technology versions, including current releases. Use the training proposal request to describe your environment and goals.

Training locations

ASP.NET Web API Essentials Using C# training across the U.S. and beyond.

We provide private ASP.NET Web API Essentials Using C# training for organizations, onsite at your location or live online, throughout the United States and internationally.

View all ASP.NET Web API Essentials Using C# training locations

Train your team with HSG

Private, instructor-led training customized for your organization.

  • Onsite or live online delivery
  • Customized curriculum
  • For a single employee or an entire team
  • Flexible scheduling
  • Experienced instructors
Request Group Training

Questions? Call us at 303.377.6176
or email info@hartmannsoftware.com

Ready to train your team?

Let's customize this training for your organization.

Tell us about your employees, your goals, and your preferred schedule. We'll prepare a training proposal covering scope, delivery format, and pricing.