SlideShare a Scribd company logo
RESTful Services
Look at creating RESTful Services using .NETNOT coveringDesign Patterns Best Practises*Overture
RESTAcronym? Representational State Transfer Source?Came about in 2000 doctoral dissertation of Roy Fielding
What is it?ROA – Resource Orientated ArchitectureWOA – Web Orientated ArchitectureThanks Gartner for another TLA It is a styleNOT APIInterfaceOfficial StandardA drop in replacement for SOAP
SetupVisual Studio - load restful service base
Make sure WCF REST template is installed
Fiddler – make sure capture traffic is off
Make sure JSON addon is installed
Tools -> Fiddler Options -> Enable IPv6 must be disabled
Rule 18Demo 1 – ASP.NET Web FormsAdd new ASP.NET Empty Web Application project - Name WebForms
Right click web project -> properties -> web -> specific port: 4000
Add Reference to BlackBox
Add new item web form – named games.aspx
Switch to code view and remove page_load method
Add render override (Ctrl+0)protected override void Render(HtmlTextWriter writer) { }Add Database Connection string (Ctrl+1)Database.ConnectionString = @"data source=C:\Users\Robert MacLean\Desktop\RESTful\WebForms\bin\superstore.sqlite";Add Response.Clear();   (Ctrl+2)
Add Request.HttpMethod switch (Ctrl+3)switch (Request.HttpMethod.ToUpperInvariant()){  case "POST":  { break;  }  case "GET":  {  break; }  case "PUT": {  break; }  case "DELETE":  {  break;  }}Add DisplayGames method signature (Ctrl+4)private void DisplayGames(HttpRequest request) {        }
Demo 1 continued.Add code to get and return all games (Ctrl+5)dynamic response;response = Database.Instance.Games.ToList();Response.ContentType = "application/json";Response.Write(JsonMagic.ConvertToJson(response));Response.StatusCode = 200;Add DisplayGames(Request); to GET case – (Ctrl+6)
RUN -> Show error in browser
Fiddler -> Request Builder -> GET: http://localhost:4000/Games.aspx -> Execute
Tour inspector
Change DisplayGames to cater for single game option (Ctrl+7)if (request.QueryString["id"] != null){Guid pk = Guid.Parse(request.QueryString["id"]);   response = (from g in Database.Instance.Games                           where g.PK == pk                           select g).ToList();}else{  response = Database.Instance.Games.ToList();  }Build -> Fiddler -> Request Builder -> GET: http://localhost:4000/Games.aspx -> Execute

More Related Content

PDF
Nativescript angular
PPTX
Angular mix chrisnoring
PPT
Micro-ORM Introduction - Don't overcomplicate
PDF
The Ring programming language version 1.5.2 book - Part 44 of 181
PDF
JavaScript ∩ WebAssembly
PDF
Agile Database Development with JSON
PPT
A gremlin in my graph confoo 2014
PDF
More than `po`: Debugging in lldb
Nativescript angular
Angular mix chrisnoring
Micro-ORM Introduction - Don't overcomplicate
The Ring programming language version 1.5.2 book - Part 44 of 181
JavaScript ∩ WebAssembly
Agile Database Development with JSON
A gremlin in my graph confoo 2014
More than `po`: Debugging in lldb

What's hot (20)

PPTX
The uniform interface is 42
PDF
The Ring programming language version 1.9 book - Part 99 of 210
PDF
Innovative Specifications for Better Performance Logging and Monitoring
PDF
More than po: Debugging in LLDB
PDF
The Ring programming language version 1.5.2 book - Part 27 of 181
PDF
Protocol-Oriented Networking
DOC
Qtp test
DOCX
5952 database systems administration (comp 1011.1)-cw1
PPTX
Modern technologies in data science
PDF
DRYing to Monad in Java8
PPTX
Tk2323 lecture 9 api json
PDF
More Than po: Debugging in LLDB @ CocoaConf SJ 2015
PPTX
Python Code Camp for Professionals 3/4
PDF
The Ring programming language version 1.5.3 book - Part 27 of 184
PPTX
Python Code Camp for Professionals 4/4
PDF
Internet Technology (Practical Questions Paper) [CBSGS - 75:25 Pattern] {Mast...
PPTX
Typed? Dynamic? Both! Cross-platform DSLs in C#
PDF
Postgres can do THAT?
PPTX
Build Lightweight Web Module
PPTX
Python Code Camp for Professionals 2/4
The uniform interface is 42
The Ring programming language version 1.9 book - Part 99 of 210
Innovative Specifications for Better Performance Logging and Monitoring
More than po: Debugging in LLDB
The Ring programming language version 1.5.2 book - Part 27 of 181
Protocol-Oriented Networking
Qtp test
5952 database systems administration (comp 1011.1)-cw1
Modern technologies in data science
DRYing to Monad in Java8
Tk2323 lecture 9 api json
More Than po: Debugging in LLDB @ CocoaConf SJ 2015
Python Code Camp for Professionals 3/4
The Ring programming language version 1.5.3 book - Part 27 of 184
Python Code Camp for Professionals 4/4
Internet Technology (Practical Questions Paper) [CBSGS - 75:25 Pattern] {Mast...
Typed? Dynamic? Both! Cross-platform DSLs in C#
Postgres can do THAT?
Build Lightweight Web Module
Python Code Camp for Professionals 2/4
Ad

Viewers also liked (20)

PPT
Costruzione Piscine Vercelli - Piscine Desjoyaux
DOC
Las medidas de coercion desde todas sus perspectivas
PDF
Comunicato su ENI
PDF
Top100summit 支付宝-贺三元-支付宝无线快捷支付的抉择
DOCX
Talent management and competitive advantage
PPTX
Putting the DOT in .NET - Dev/Ops/Test
PPTX
Visual Studio ❤ JavaScript
ODT
Interrogazione 5 03647 Tempa Rossa vRipetizione VIA
PPTX
DevConf Survival Guide
PPTX
Lightswitch
PPTX
Windows Server AppFabric Caching - What it is & when you should use it?
PPTX
Win8 architecture for developers
PPTX
Microsoft CRM
PPTX
RESTful design
PPTX
Enterprise Library 5
PPT
Windows Server AppFabric
PPTX
PPT
.NET Reflection
PPTX
Source Control 101
PDF
Costruzione Piscine Vercelli - Piscine Desjoyaux
Las medidas de coercion desde todas sus perspectivas
Comunicato su ENI
Top100summit 支付宝-贺三元-支付宝无线快捷支付的抉择
Talent management and competitive advantage
Putting the DOT in .NET - Dev/Ops/Test
Visual Studio ❤ JavaScript
Interrogazione 5 03647 Tempa Rossa vRipetizione VIA
DevConf Survival Guide
Lightswitch
Windows Server AppFabric Caching - What it is & when you should use it?
Win8 architecture for developers
Microsoft CRM
RESTful design
Enterprise Library 5
Windows Server AppFabric
.NET Reflection
Source Control 101
Ad

Similar to Developing RESTful Services in .NET (20)

PPTX
Yahoo Query Language: Select * from Internet
PPTX
XML-Free Programming
ODP
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...
PPT
We sport architecture_implementation
PPTX
Open Source Ajax Solution @OSDC.tw 2009
PDF
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
PPTX
Ajax for dummies, and not only.
DOCX
Ordering System IP2buildclasses.netbeans_automatic_buildO.docx
DOCX
Doctype htm1
DOCX
VPN Access Runbook
PPT
Testing persistence in PHP with DbUnit
PPT
Mobile webapplication development
PDF
Bootiful Development with Spring Boot and React - Belfast JUG 2018
PDF
Future of Web Apps: Google Gears
PPTX
Working effectively with legacy code
PPT
Core Php Component Presentation
PPT
Corephpcomponentpresentation 1211425966721657-8
PDF
Let's Play- Overview
PPTX
SharePoint Conference 2018 - APIs, APIs everywhere!
PDF
ERRest - Designing a good REST service
Yahoo Query Language: Select * from Internet
XML-Free Programming
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...
We sport architecture_implementation
Open Source Ajax Solution @OSDC.tw 2009
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Ajax for dummies, and not only.
Ordering System IP2buildclasses.netbeans_automatic_buildO.docx
Doctype htm1
VPN Access Runbook
Testing persistence in PHP with DbUnit
Mobile webapplication development
Bootiful Development with Spring Boot and React - Belfast JUG 2018
Future of Web Apps: Google Gears
Working effectively with legacy code
Core Php Component Presentation
Corephpcomponentpresentation 1211425966721657-8
Let's Play- Overview
SharePoint Conference 2018 - APIs, APIs everywhere!
ERRest - Designing a good REST service

More from Robert MacLean (20)

PPTX
Deno ...................................
PPTX
14 things you need to be a successful software developer (v3)
PPTX
OWASP TOP 10
PPTX
Building a µservice with Kotlin, Micronaut & GCP
PPTX
Looking at the Vue
PPTX
Kotlin 101
PPTX
Features of Kotlin I find exciting
PPTX
JavaScript Gotchas
PPTX
The state of testing @ Microsoft
PPTX
What is new in C# 6?
PPTX
A Developer Day 2014 - Durban
PPTX
Agile lessons learned in the Microsoft ALM Rangers
PPTX
Hour of code - Train the trainer
PPTX
Building services for apps on a shoestring budget
PPTX
3 things your app API is doing WRONG
PPTX
PPTX
LightSwitch
PPTX
How to build a Mobile API or HTML 5 app in 5 minutes
PPTX
Protection of Personal Information Bill (POPI)
Deno ...................................
14 things you need to be a successful software developer (v3)
OWASP TOP 10
Building a µservice with Kotlin, Micronaut & GCP
Looking at the Vue
Kotlin 101
Features of Kotlin I find exciting
JavaScript Gotchas
The state of testing @ Microsoft
What is new in C# 6?
A Developer Day 2014 - Durban
Agile lessons learned in the Microsoft ALM Rangers
Hour of code - Train the trainer
Building services for apps on a shoestring budget
3 things your app API is doing WRONG
LightSwitch
How to build a Mobile API or HTML 5 app in 5 minutes
Protection of Personal Information Bill (POPI)

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Empathic Computing: Creating Shared Understanding
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Machine Learning_overview_presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Machine learning based COVID-19 study performance prediction
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Programs and apps: productivity, graphics, security and other tools
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Empathic Computing: Creating Shared Understanding
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The Rise and Fall of 3GPP – Time for a Sabbatical?
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
Encapsulation_ Review paper, used for researhc scholars
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine Learning_overview_presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Spectral efficient network and resource selection model in 5G networks
Machine learning based COVID-19 study performance prediction
The AUB Centre for AI in Media Proposal.docx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MYSQL Presentation for SQL database connectivity
Programs and apps: productivity, graphics, security and other tools

Developing RESTful Services in .NET