Search Preview
REST using the WCF Web API – POST it! | Alexander Zeitler
alexanderzeitler.com.com > alexanderzeitler.com
SEO audit: Content analysis
Language | Error! No language localisation is found. | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Title | REST using the WCF Web API – POST it! | Alexander Zeitler | ||||||||||||||||||||||||||||||||||||
Text / HTML ratio | 52 % | ||||||||||||||||||||||||||||||||||||
Frame | Excellent! The website does not use iFrame solutions. | ||||||||||||||||||||||||||||||||||||
Flash | Excellent! The website does not have any flash contents. | ||||||||||||||||||||||||||||||||||||
Keywords cloud |
contact REST WCF Web API = response Part RESTful HttpResponseMessage |
||||||||||||||||||||||||||||||||||||
Keywords consistency |
|
||||||||||||||||||||||||||||||||||||
Headings |
|
||||||||||||||||||||||||||||||||||||
Images | We found 2 images on this web page. |
SEO Keywords (Single)
Keyword | Occurrence | Density |
---|---|---|
contact | 13 | 0.65 % |
REST | 13 | 0.65 % |
WCF | 13 | 0.65 % |
Web | 13 | 0.65 % |
API | 13 | 0.65 % |
= | 13 | 0.65 % |
response | 11 | 0.55 % |
Part | 10 | 0.50 % |
RESTful | 8 | 0.40 % |
HttpResponseMessage |
7 | 0.35 % |
return | 7 | 0.35 % |
POST | 5 | 0.25 % |
PostContact | 4 | 0.20 % |
ContentLength | 4 | 0.20 % |
_contactRepositoryInsertcontact | 4 | 0.20 % |
applicationjson | 4 | 0.20 % |
HTTP11 | 4 | 0.20 % |
HttpResponseMessage |
4 | 0.20 % |
public | 4 | 0.20 % |
Wegner | 3 | 0.15 % |
SEO Keywords (Two Word)
Keyword | Occurrence | Density |
---|---|---|
Web API | 13 | 0.65 % |
using the | 12 | 0.60 % |
REST using | 11 | 0.55 % |
the WCF | 11 | 0.55 % |
WCF Web | 11 | 0.55 % |
PostContact contact | 4 | 0.20 % |
new HttpResponseMessage |
4 | 0.20 % |
is done | 4 | 0.20 % |
contact = | 4 | 0.20 % |
= _contactRepositoryInsertcontact | 4 | 0.20 % |
HttpResponseMessage |
4 | 0.20 % |
public HttpResponseMessage |
4 | 0.20 % |
API getting | 4 | 0.20 % |
= new | 4 | 0.20 % |
_contactRepositoryInsertcontact HttpResponseMessage |
3 | 0.15 % |
return response | 3 | 0.15 % |
ContentType applicationjson | 3 | 0.15 % |
HttpResponseMessage |
3 | 0.15 % |
response = | 3 | 0.15 % |
return new | 3 | 0.15 % |
SEO Keywords (Three Word)
Keyword | Occurrence | Density | Possible Spam |
---|---|---|---|
REST using the | 11 | 0.55 % | No |
using the WCF | 11 | 0.55 % | No |
the WCF Web | 11 | 0.55 % | No |
WCF Web API | 11 | 0.55 % | No |
Web API getting | 4 | 0.20 % | No |
public HttpResponseMessage |
4 | 0.20 % | No |
HttpResponseMessage |
4 | 0.20 % | No |
contact = _contactRepositoryInsertcontact | 4 | 0.20 % | No |
response = new | 3 | 0.15 % | No |
= _contactRepositoryInsertcontact HttpResponseMessage |
3 | 0.15 % | No |
_contactRepositoryInsertcontact HttpResponseMessage |
3 | 0.15 % | No |
HttpResponseMessage |
3 | 0.15 % | No |
= new HttpResponseMessage |
3 | 0.15 % | No |
new HttpResponseMessage |
3 | 0.15 % | No |
HttpResponseMessage |
3 | 0.15 % | No |
ASPNET Development Server10000 | 3 | 0.15 % | No |
responseStatusCode = HttpStatusCodeCreated | 3 | 0.15 % | No |
Server ASPNET Development | 3 | 0.15 % | No |
Development Server10000 Date | 3 | 0.15 % | No |
Date Tue 03 | 3 | 0.15 % | No |
SEO Keywords (Four Word)
Keyword | Occurrence | Density | Possible Spam |
---|---|---|---|
REST using the WCF | 11 | 0.55 % | No |
using the WCF Web | 11 | 0.55 % | No |
the WCF Web API | 11 | 0.55 % | No |
WCF Web API getting | 4 | 0.20 % | No |
public HttpResponseMessage |
4 | 0.20 % | No |
Date Tue 03 May | 3 | 0.15 % | No |
Server10000 Date Tue 03 | 3 | 0.15 % | No |
Development Server10000 Date Tue | 3 | 0.15 % | No |
ASPNET Development Server10000 Date | 3 | 0.15 % | No |
Server ASPNET Development Server10000 | 3 | 0.15 % | No |
HttpResponseMessage |
3 | 0.15 % | No |
contact = _contactRepositoryInsertcontact HttpResponseMessage |
3 | 0.15 % | No |
Tue 03 May 2011 | 3 | 0.15 % | No |
= new HttpResponseMessage |
3 | 0.15 % | No |
= _contactRepositoryInsertcontact HttpResponseMessage |
3 | 0.15 % | No |
HttpResponseMessage |
3 | 0.15 % | No |
response = new HttpResponseMessage |
3 | 0.15 % | No |
_contactRepositoryInsertcontact HttpResponseMessage |
3 | 0.15 % | No |
new HttpResponseMessage |
3 | 0.15 % | No |
RESTful the BDD way | 2 | 0.10 % | No |
Internal links in - alexanderzeitler.com
Fixing Chrome 58+ [missing_subjectAltName] with openssl when using self signed certificates | Alexander Zeitler
Accessing an HTTP API running on your MacBook in a Docker container from your iPhone/iPad using dnsmasq | Alexander Zeitler
Deploying Ubuntu Mate Desktop as a developer environment in a Azure VM | Alexander Zeitler
Deploying Ubuntu Mate Desktop as a developer environment in AWS EC2 | Alexander Zeitler
Debugging mocha tests in a Docker container using Visual Studio Code | Alexander Zeitler
Debugging mocha tests with Visual Studio Code when Node.js is installed using nvm | Alexander Zeitler
Debugging a ES6 Node.js application in a Docker container using Visual Studio Code | Alexander Zeitler
Some thoughts on Open Source Software | Alexander Zeitler
Resizing a VMware Workstation VM partition using GParted - get the swap partition out of my way! | Alexander Zeitler
Workflows: using Docker Machine and Docker Compose together in development | Alexander Zeitler
Chrome crashes on Ubuntu in VMware Workstation | Alexander Zeitler
Rename Visual Studio project including files, folders and namespaces | Alexander Zeitler
A lap around AWS and docker-machine | Alexander Zeitler
Integration-testing ASP.NET 5 / MVC 6 Controllers on DNX Beta 4 | Alexander Zeitler
Deploying a ASP.NET MVC 6 API as Azure API App in Azure App Services | Alexander Zeitler
lowerCamelCase JSON with ASP.NET MVC 6 | Alexander Zeitler
Running ASP.NET 5 Beta 4 in Docker with DNX runtime #aspnet5 #docker | Alexander Zeitler
Stop complaining or improve yourself | Alexander Zeitler
#NodeJS / #ExpressJS: Adding routes dynamically at runtime | Alexander Zeitler
mongoose: Referencing schema in properties or arrays | Alexander Zeitler
MongoDB development environment journal size management using mongoctl | Alexander Zeitler
Farewell... | Alexander Zeitler
Inspecting AngularJS $scope using Firebug and Chrome Developer Tools | Alexander Zeitler
Useful @Brackets extensions for Web Developers | Alexander Zeitler
.NET User Group Karlsruhe: StreamInsight: Complex Event Processing by Microsoft | Alexander Zeitler
“Commit all must be called when a managed buffer has focus” in Microsoft SQL Server Data Tools | Alexander Zeitler
.NET User Group Karlsruhe: Git | Alexander Zeitler
Open Source Windows 8 App: Sprudelsuche | Alexander Zeitler
Open Source– Scheissegal? | Alexander Zeitler
Lowercase JSON with ASP.NET Web API | Alexander Zeitler
.NET Usergroup Karlsruhe: Think Big – Entwicklung skalierbarer Anwendungen mit Windows Azure | Alexander Zeitler
ASP.NET Web API and RavenDb | Alexander Zeitler
ASP.NET Web API Round-Up Slides | Alexander Zeitler
ASP.NET MVC 4 public beta including ASP.NET Web API | Alexander Zeitler
Hash Bang Urls in Single Page Applications mit ASP.NET MVC | Alexander Zeitler
.NET User Group Karlsruhe: Know your Tools | Alexander Zeitler
Git flow init liefert: flags: FATAL unable to determine getopt version unter Cygwin | Alexander Zeitler
Using JsonValue and JsonArray in WCF Web API | Alexander Zeitler
.NET User Group Karlsruhe: PowerShell 3.. 2.. 1.. | Alexander Zeitler
What’s new in WCF Web API Preview 5 – introducing the test client | Alexander Zeitler
Externe Templates in KnockoutJS laden | Alexander Zeitler
WCF Web API: Role based access control with basic authentication | Alexander Zeitler
.NET User Group Karlsruhe: Produce Cleaner Code with Aspect-Oriented Programming (AOP) | Alexander Zeitler
REST using the WCF Web API – POST it! | Alexander Zeitler
REST using the WCF Web API – getting more RESTful responses (Part 5) | Alexander Zeitler
TypeLoadException when mocking COM objects - Could not load type … from assembly. The type is marked… | Alexander Zeitler
REST using the WCF Web API – getting RESTful the BDD way (Part 4) | Alexander Zeitler
REST using the WCF Web API – refactoring to IoC style (Part 3) | Alexander Zeitler
REST using the WCF Web API – Basics (Part2) | Alexander Zeitler
Microsoft Web API – the REST is done by WCF (Part 1) | Alexander Zeitler
Microsoft Web API – den REST macht WCF (Teil 1) | Alexander Zeitler
.NET User Group Karlsruhe: Flexible Softwarearchitekturen mit Inversion of Control (IoC) | Alexander Zeitler
machine.fakes ReSharper Templates | Alexander Zeitler
CreateCert.cmd aus dem Windows Azure Platform Training Kit funktioniert nicht | Alexander Zeitler
JSON via jQuery direkt an einen ASP.NET MVC 3 Controller senden | Alexander Zeitler
POSTing Json data using the HttpClient from WCF Web API | Alexander Zeitler
Using the new WCF Web APIs HttpClient with ASP.NET Forms Authentication | Alexander Zeitler
Keyboard Jedi unter x64 | Alexander Zeitler
Using WCF Web APIs / WCF Http with ASP.NET Forms Authentication | Alexander Zeitler
WCF Web APIs / WCF Http mit ASP.NET Forms Authentication verwenden | Alexander Zeitler
ILSpy – Open Source .NET Assembly Browser und Decompiler | Alexander Zeitler
Alexanderzeitler.com Spined HTML
REST using the WCF Web API – POST it! | Alexander Zeitler Toggle navigation Home Feed REST using the WCF Web API – POST it! Written on May 04, 2011 Postings published on this series so far: Microsoft Web API -- the REST is washed-up by WCF (Part 1) REST using the WCF Web API -- Basics (Part2) REST using the WCF Web API -- refactoring to IoC style (Part 3) REST using the WCF Web API -- getting RESTful the BDD way (Part 4) REST using the WCF Web API -- getting increasingly RESTful responses (Part 5) REST using the WCF Web API -- Post it! (Part 6) -- this one When using RESTful services you certainly don't want to GET data only but moreover insert them. Using the semantics of HTTP this is washed-up using the POST method. The simplest implementation looks like this: [WebInvoke(UriTemplate = "",Method = "POST")] public HttpResponseMessage<Contact> Post(Contact contact) { contact = _contactRepository.Insert(contact); return new HttpResponseMessage<Contact>(contact); } Invoking this on http://localhost:2201/contacts using this request: POST http://localhost:2201/contacts HTTP/1.1 User-Agent: Fiddler Content-Type: application/json Accept: application/json Host: localhost:2201 Content-Length: 23 {"Name":"Wade Wegner"} We get the pursuit response: HTTP/1.1 200 OK Server: ASP.NET Development Server/10.0.0.0 Date: Tue, 03 May 2011 20:57:54 GMT X-AspNet-Version: 4.0.30319 Content-Length: 30 Cache-Control: private Content-Type: application/json; charset=utf-8 Connection: Close {"Id":4,"Name":"Wade Wegner"} As we've learned in the previous post we should be stateful in our response so we add the HTTP status lawmaking 201 for "Created" when everything went fine: [WebInvoke(UriTemplate = "",Method = "POST")] public HttpResponseMessage<Contact> Post(Contact contact) { contact = _contactRepository.Insert(contact); HttpResponseMessage<Contact> response = new HttpResponseMessage<Contact>(contact); response.StatusCode = HttpStatusCode.Created; return response; } Stupidly, things work not unchangingly as excepted and a vendee of our service may send a Contact that is null. We should state on that with an towardly response: [WebInvoke(UriTemplate = "",Method = "POST")] public HttpResponseMessage<Contact> Post(Contact contact) { if(null == contact) { return new HttpResponseMessage<Contact>(HttpStatusCode.BadRequest); } contact = _contactRepository.Insert(contact); HttpResponseMessage<Contact> response = new HttpResponseMessage<Contact>(contact); response.StatusCode = HttpStatusCode.Created; return response; } The response to our POSTed null contact: HTTP/1.1 400 Bad Request Server: ASP.NET Development Server/10.0.0.0 Date: Tue, 03 May 2011 21:14:14 GMT X-AspNet-Version: 4.0.30319 Cache-Control: private Content-Length: 0 Connection: Close But we're still not washed-up on our way to a RESTful POST implementation: In a RESTful tracery it is a weightier practice to return the URI under which the newly created resource is misogynist for remoter operations. In our example this would be__http://localhost/contact/4: [WebInvoke(UriTemplate = "", Method = "POST")] public HttpResponseMessage<Contact> Post(Contact contact, HttpRequestMessage<Contact> request) { if (null == contact) { return new HttpResponseMessage<Contact>(HttpStatusCode.BadRequest); } contact = _contactRepository.Insert(contact); HttpResponseMessage<Contact> response = new HttpResponseMessage<Contact>(contact); response.StatusCode = HttpStatusCode.Created; var uriBuilder = new UriBuilder(request.RequestUri); uriBuilder.Path = string.Format("contact/{0}", contact.Id); response.Headers.Location = uriBuilder.Uri; return response; } When POSTing the contact now, we'll receive the pursuit response containing the location of our new contact: HTTP/1.1 201 Created Server: ASP.NET Development Server/10.0.0.0 Date: Tue, 03 May 2011 21:28:42 GMT X-AspNet-Version: 4.0.30319 Content-Length: 30 Location: http://localhost:2201/contact/4 Cache-Control: private Content-Type: application/json; charset=utf-8 Connection: Close {"Id":4,"Name":"Wade Wegner"} For now we've seen the most important facts well-nigh POSTing data in a RESTful scenario. There are some increasingly options on POST to discover when we're playing virtually with PUT - but this is washed-up in the next part of this series. Stay tuned! Postings published on this series so far: Microsoft Web API -- the REST is washed-up by WCF (Part 1) REST using the WCF Web API -- Basics (Part2) REST using the WCF Web API -- refactoring to IoC style (Part 3) REST using the WCF Web API -- getting RESTful the BDD way (Part 4) REST using the WCF Web API -- getting increasingly RESTful responses (Part 5) REST using the WCF Web API -- Post it! (Part 6) -- this one Please enable JavaScript to view the comments powered by Disqus. Copyright © Alexander Zeitler 2003 - 2016 | Impressum