RE: Web API HelpPage
On a tangent, but might be of interest to some: DocPreview, in the VS Gallery – similar to Resharper's XML documentation preview (but free, though Resharper is not pricey of course and does much more). http://bit.ly/1U4wbfn Developed by Oleg Shilo, relies on the source code (not the assemblies), supports C#/C++, in active development this month (v1.0.30). Related (sort of) is immoDoc.NET https://github.com/marek-stoj/ImmDoc.NET which is (quoting) – a command-line utility for generating HTML documentation from a set of .NET assemblies and XML files created by the compiler. It's developed in C#. • Simple • Light-weight • Blazingly fast • 10-20 times faster than VsDocMan • 20-25 times faster than Sandcastle • Supports .NET Framework 2.0 and above • Can generate HTML and CHM documentation • Uses Mono.Cecil Ian Thomas Albert Park, Victoria 3206 Australia
RE: Web API HelpPage
We started using the WebAPI help package quite some time ago. We did some tweaks, it came out with an update, we updated, broke pretty much everything. We have since customised the crap out of it and are now pretty happy with it. There are some shortcomings but overall it is doing what we want and dev story is pretty clean. We absolutely advocate some manual content that augment the pure tech stuff tho. You can see the result here https://api.saasu.com We have made the call a little while ago to not worry about any future upgrades, or anything like that. It has enough customisation to not warrant the pain of breakage. - Glav From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of DotNet Dude Sent: Wednesday, 9 March 2016 10:52 AM To: ozDotNet <ozdotnet@ozdotnet.com> Subject: Re: Web API HelpPage On Wed, Mar 9, 2016 at 10:27 AM, Greg Keogh <gfke...@gmail.com <mailto:gfke...@gmail.com> > wrote: Folks, just a heads-up ... I was looking for a way of auto-generating Web API documentation and I found THIS <http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages> from 2013, and there are similar articles all over the place, all a bit old. The advice on getting it going works after you add the Nuget package and make the tweaks. However: * I had to manually alter the package code to read and merge multiple xmldoc files. * I cannot get the Request Formats to say anything but "Sample not available". * I cannot get the Additional Information column to display anything because my entity classes are in a portable library and can't have attributes applied to them. * All standard xmldoc tags in your comments are stripped back to empty strings in the web API help, meaning you can't have both API help and Sandcastle help for the same code with nice formatting and links. * Instructions on how to style the API help no longer work and it's all dull black and white. So for simple API help it works, but the moment you want to customise or enhance anything it all goes to hell. I've wasted up to 4 solid hours trying to workaround all of the irritations I described. It's like someone had a great idea with this, but coded it like a high school project. lol sound like every project I've inherited Perhaps there are better tools, but a quick look at Swagger hints that you have to write almost all of the documentation and samples manually as JSON. GK
Re: Web API Accept type
I would provide two different methods. It's easier for you and easier for the end developers to understand. In the end I sort of did that. It's best not to fight the system, so I changed the method so that it simply returns a serialized object (a rather complicated one), but no matter what format the request asks for I just let the infrastructure pick the serializer and return it. I don't even tamper with the shape of the JSON or XML that's returned. Yeah, *don't fight the system* if you can avoid it! -- *GK*
Re: Web API Accept type
I would provide two different methods. It's easier for you and easier for the end developers to understand. Davy Sent from my iPhone On 17 Aug 2015, at 23:56, Greg Keogh gfke...@gmail.com wrote: Folks, in Web API when you sent an object back in the response it's automatically serialized as JSON or XML depending upon the Accept header. This is great, but I have to cheat the system slightly and send back manually tweaked XML only if the XML serializer is active. Rather than look at the raw text of the request Accept headers, is there is more formal way of knowing which serializer is active (if this means anything) -- GK
Re: Web API Accept type
Hi Greg, Sounds like this is what you want: http://www.asp.net/web-api/overview/formats-and-model-binding/media-formatters You can define your own media formatter to customise your response for particular types Regards, Nelson Chan On 18 August 2015 at 20:04, Greg Keogh gfke...@gmail.com wrote: I would provide two different methods. It's easier for you and easier for the end developers to understand. In the end I sort of did that. It's best not to fight the system, so I changed the method so that it simply returns a serialized object (a rather complicated one), but no matter what format the request asks for I just let the infrastructure pick the serializer and return it. I don't even tamper with the shape of the JSON or XML that's returned. Yeah, *don't fight the system* if you can avoid it! -- *GK*
Re: Web API Accept type
Is you tweak of the xml generic, ie. will happen to every xml response? If so I'd imagine the method would be to override the default xml serializer (or implement some interface) and tell web api to use your one instead of the default. Testing which one is active by any means just seems hacky. Or perhaps I've misunderstood On Tue, Aug 18, 2015 at 7:56 AM, Greg Keogh gfke...@gmail.com wrote: Folks, in Web API when you sent an object back in the response it's automatically serialized as JSON or XML depending upon the Accept header. This is great, but I have to cheat the system slightly and send back manually tweaked XML only if the XML serializer is active. Rather than look at the raw text of the request Accept headers, is there is more formal way of knowing which serializer is active (if this means anything) -- *GK*
Re: Web API and https timeout
Does the https one work on its own (http one removed or disabled)? On Fri, Aug 7, 2015 at 4:30 PM, Greg Keogh gfke...@gmail.com wrote: Folks, I've put a Web API project (created by the VS2015 Framework 4.5 wizard) on my server. I've got two applications pointing to the folder with the app files, one site is http scheme and the other site has a certificate for https. The app responds and works okay with http, but it times out for https. http://www.gregsite.com.au/myapp/v3/blah?p=glop (works) https://www.gregsite.net.au/myapp/v3/blah?p=glop (times out) I'm quite disappointed, and I can't find any special config settings or other tricks and web searches don't help as usual so far. Anyone got a clue? *Greg K*
Re: Web API and https timeout
On Fri, Aug 7, 2015 at 5:19 PM, Greg Keogh gfke...@gmail.com wrote: Does the https one work on its own (http one removed or disabled)? They are completely independent, in different sites and different app pools, they only share the executable files folder (and I know the permissions are okay). The https one times out under all experiments I've run so far. I'm really surprised because REST style services and projects are relatively simple compared to WCF services where I've previously had to tweak the config file for https or http (which took hours of research!). I expected it to just GO! -- *GK* I'd just start with the https one alone and get that working just to ensure it has nothing to do with the sharing of files. If it doesn't work alone then https isn't configured correctly. Sorry not clear if you've already tried this. Also I think there is a enableSSL or similar somewhere in the project properties in case you've missed it.
Re: Web API and https timeout
OK FOLKS! Those of you who are sys admins don't laugh at what I just found, by accidentally noticing that all of my web sites where slowly vanishing throughout the afternoon... Around 11am this morning I finished migrating 6 of my domains from one provider to another. I set the DNS A records for all domains to point to my home server's IP address. However, I transposed two digits of the address and as a result, all domains slowly vanished as the records were propagated around the globe. That's certainly why my https test failed, then an hour later the http test failed (as the domain vanished). At 17:30 all my domains were invisible, so I just put the correct IP back in all of them. Now I wait and maybe later tonight I'll find that my REST API is working as I originally expected. Amazing eh?! -- *Greg K* On 7 August 2015 at 17:35, Bec C bec.usern...@gmail.com wrote: On Fri, Aug 7, 2015 at 5:19 PM, Greg Keogh gfke...@gmail.com wrote: Does the https one work on its own (http one removed or disabled)? They are completely independent, in different sites and different app pools, they only share the executable files folder (and I know the permissions are okay). The https one times out under all experiments I've run so far. I'm really surprised because REST style services and projects are relatively simple compared to WCF services where I've previously had to tweak the config file for https or http (which took hours of research!). I expected it to just GO! -- *GK* I'd just start with the https one alone and get that working just to ensure it has nothing to do with the sharing of files. If it doesn't work alone then https isn't configured correctly. Sorry not clear if you've already tried this. Also I think there is a enableSSL or similar somewhere in the project properties in case you've missed it.
Re: Web API and https timeout
Haha classic On Friday, 7 August 2015, Greg Keogh gfke...@gmail.com wrote: OK FOLKS! Those of you who are sys admins don't laugh at what I just found, by accidentally noticing that all of my web sites where slowly vanishing throughout the afternoon... Around 11am this morning I finished migrating 6 of my domains from one provider to another. I set the DNS A records for all domains to point to my home server's IP address. However, I transposed two digits of the address and as a result, all domains slowly vanished as the records were propagated around the globe. That's certainly why my https test failed, then an hour later the http test failed (as the domain vanished). At 17:30 all my domains were invisible, so I just put the correct IP back in all of them. Now I wait and maybe later tonight I'll find that my REST API is working as I originally expected. Amazing eh?! -- *Greg K* On 7 August 2015 at 17:35, Bec C bec.usern...@gmail.com javascript:_e(%7B%7D,'cvml','bec.usern...@gmail.com'); wrote: On Fri, Aug 7, 2015 at 5:19 PM, Greg Keogh gfke...@gmail.com javascript:_e(%7B%7D,'cvml','gfke...@gmail.com'); wrote: Does the https one work on its own (http one removed or disabled)? They are completely independent, in different sites and different app pools, they only share the executable files folder (and I know the permissions are okay). The https one times out under all experiments I've run so far. I'm really surprised because REST style services and projects are relatively simple compared to WCF services where I've previously had to tweak the config file for https or http (which took hours of research!). I expected it to just GO! -- *GK* I'd just start with the https one alone and get that working just to ensure it has nothing to do with the sharing of files. If it doesn't work alone then https isn't configured correctly. Sorry not clear if you've already tried this. Also I think there is a enableSSL or similar somewhere in the project properties in case you've missed it.
Re: Web API and https timeout
Does the https one work on its own (http one removed or disabled)? They are completely independent, in different sites and different app pools, they only share the executable files folder (and I know the permissions are okay). The https one times out under all experiments I've run so far. I'm really surprised because REST style services and projects are relatively simple compared to WCF services where I've previously had to tweak the config file for https or http (which took hours of research!). I expected it to just GO! -- *GK*
Re: Web API response formatting
Accept header is the norm On 20 January 2014 15:03, Greg Keogh g...@mira.net wrote: Folks, what is the recommended way of letting the caller choose the format of the response? I have a method that can return plain text or XML, so how does the caller choose the one they want? I could have a format= parameter on the method call (Rackspace do that), or is it better to inspect the Accept header and obey it? Or something else? Greg K
Re: Web API response formatting
In WCF you use automaticFormatSelectionEnabled=true/false to tell it to parse the header to work out what type of response to send back. I'm not sure whether it is the same in WebAPI. It seems a bit ugly to do via a querystring parameter. From: Greg Keogh g...@mira.net To: ozDotNet ozdotnet@ozdotnet.com Sent: Monday, 20 January 2014 3:03 PM Subject: Web API response formatting Folks, what is the recommended way of letting the caller choose the format of the response? I have a method that can return plain text or XML, so how does the caller choose the one they want? I could have a format= parameter on the method call (Rackspace do that), or is it better to inspect the Accept header and obey it? Or something else? Greg K
Re: Web API response formatting
Chaps, after some doodling around I see I can get the Accept values straight out of the Request in the controller's code. That does now seem to be the logical way of choosing the response format. More confusion though ... I tried to write a controller method that returned either plain text or XML, but the samples I've found return different types. One does this: public HttpActionResult Sample1() return Ok(hello); public HttpResponseMessage Sample2() return new HttpResponseMessage() { Content = new StringContent(hello) }; On 20 January 2014 13:12, Dave Walker rangitat...@gmail.com wrote: Accept header is the norm On 20 January 2014 15:03, Greg Keogh g...@mira.net wrote: Folks, what is the recommended way of letting the caller choose the format of the response? I have a method that can return plain text or XML, so how does the caller choose the one they want? I could have a format= parameter on the method call (Rackspace do that), or is it better to inspect the Accept header and obey it? Or something else? Greg K
Re: Web API response formatting
Please ignore previous message as I hit Send instead of Save (bloody Gmail interface!). Here's the correct message: Chaps, after some doodling around I see I can get the Accept values straight out of the Request in the controller's code. That does now seem to be the logical way of choosing the response format. More confusion though ... I tried to write a controller method that returned either plain text or XML, but the samples I've found return different types. Here are the two samples: public HttpActionResult Sample1() return Ok(hello); public HttpResponseMessage Sample2() return new HttpResponseMessage() { Content = new StringContent(hello) }; The firsts returns Stringhello/String and the second returns the plain text hello. But they're different return types and I can't figure out how get one method to return Xml or text. Anyone know how. I'm still searching. Greg K
Re: Web API response formatting
Greg, let the web API deal with the formatting. Your controller should ideally just return an object which will be formatted according to the request. (apologies for brevity, I am playing mini golf with my son) Try it in Fiddler and you can see how changing the request will change the output. If you hard code the response type you are introducing unnecessary coupling snd potential future headaches. Sent from my flux capacitor. Please excuse brevity and any odd autocorrect errors. On 20/01/2014 1:54 PM, Greg Keogh g...@mira.net wrote: Please ignore previous message as I hit Send instead of Save (bloody Gmail interface!). Here's the correct message: Chaps, after some doodling around I see I can get the Accept values straight out of the Request in the controller's code. That does now seem to be the logical way of choosing the response format. More confusion though ... I tried to write a controller method that returned either plain text or XML, but the samples I've found return different types. Here are the two samples: public HttpActionResult Sample1() return Ok(hello); public HttpResponseMessage Sample2() return new HttpResponseMessage() { Content = new StringContent(hello) }; The firsts returns Stringhello/String and the second returns the plain text hello. But they're different return types and I can't figure out how get one method to return Xml or text. Anyone know how. I'm still searching. Greg K
Re: Web API response formatting
From my limited reading on this I think you will struggle to remove the xmlns, the rationale being that without a namespace the xml is not valid. While technically true, it is also annoying. Personally I have a strong preference for JSON these days and use it whenever I can... simple, ubiquitous and hardly any rules to conform to. YMMV. Cheers Dave Sent from my flux capacitor. Please excuse brevity and any odd autocorrect errors. On 20/01/2014 3:03 PM, Greg Keogh g...@mira.net wrote: I can confirm that WebAPI does as you say and it looks for a formatter that matches the Accept header ... To make things easier and consistent for everyone I have abandoned the idea of returning plain text in some methods, I will always return an XML serialised class no matter how small the data might be. This is easier to document and the client will probably appreciate it. So the confusion about choosing text or xml will go away. I'll leave my text formatter there as a stub just in case someone wants csv formatting or similar later. I notice that if my controller method returns string then the xml formatter sends back Stringhello/String and Accept text/plain returns hello, which makes sense. If I try to get a class back as text it ignores me and I get XML anyway, which also makes sense. My task now is to remove the xmlns= clutter from the xml root. Part of my learners confusion is the large numbers of return types that are possible from controller methods, some not even in the same class hierarchy. Greg K On 20 January 2014 14:31, David Burstin david.burs...@gmail.com wrote: Greg, let the web API deal with the formatting. Your controller should ideally just return an object which will be formatted according to the request. (apologies for brevity, I am playing mini golf with my son) Try it in Fiddler and you can see how changing the request will change the output. If you hard code the response type you are introducing unnecessary coupling snd potential future headaches. Sent from my flux capacitor. Please excuse brevity and any odd autocorrect errors. On 20/01/2014 1:54 PM, Greg Keogh g...@mira.net wrote: Please ignore previous message as I hit Send instead of Save (bloody Gmail interface!). Here's the correct message: Chaps, after some doodling around I see I can get the Accept values straight out of the Request in the controller's code. That does now seem to be the logical way of choosing the response format. More confusion though ... I tried to write a controller method that returned either plain text or XML, but the samples I've found return different types. Here are the two samples: public HttpActionResult Sample1() return Ok(hello); public HttpResponseMessage Sample2() return new HttpResponseMessage() { Content = new StringContent(hello) }; The firsts returns Stringhello/String and the second returns the plain text hello. But they're different return types and I can't figure out how get one method to return Xml or text. Anyone know how. I'm still searching. Greg K
Re: Web API weird problems
For problem 2: get codemaid plugin or resharper and reorder your properties: Or you could use an xslt to transform your serialization ordering your properties as you go. Davy. Sent from my starfleet datapad. On 17 janv. 2014, at 09:43, Greg Keogh g...@mira.net wrote: Is anyone in here using Web API in anger? I'm experimenting with creating an API that is simple and easy for non .NET clients to use. Controller methods that return classes serialised as XML contain everything I expect but... *PROBLEM 1* : There are xmlsn= namespaces cluttering up the root node that I can't get rid of. I tried a few tricks in web searches but it changes nothing. Anyone know how to get rid of them and get plain XML? My next hurdle is a POST to create a record. The Request below actually works, but after hours of suffering I overcame two really weird problems to make it work, otherwise you get the dreaded 500 error: *PROBLEM-2* : The XML property elements have to be in alphabetical order (no kidding!!). They are not in order inside the class. *PROBLEM-3* : Related to No.1, I have to put the tedious namespaces in the root element. Greg K POST http://raven/authapi/user/create HTTP/1.1 Content-Type: text/xml Accept: application/xml Host: raven ApiUser xmlns:i=http://www.w3.org/2001/XMLSchema-instance; xmlns= http://schemas.datacontract.org/2004/07/RCS.AuthService.RestApi; Namemax/Name PasswordT0pSecret/Password SpokenNameMax Headroom/SpokenName /ApiUser
Re: Web API weird problems
Hi Greg, Have you looked at either of the solutions in http://stackoverflow.com/questions/12590801/remove-namespace-in-xml-from-asp-net-web-api Cheers Dave On 17 January 2014 21:25, Davy Jones djones...@gmail.com wrote: For problem 2: get codemaid plugin or resharper and reorder your properties: Or you could use an xslt to transform your serialization ordering your properties as you go. Davy. Sent from my starfleet datapad. On 17 janv. 2014, at 09:43, Greg Keogh g...@mira.net wrote: Is anyone in here using Web API in anger? I'm experimenting with creating an API that is simple and easy for non .NET clients to use. Controller methods that return classes serialised as XML contain everything I expect but... *PROBLEM 1* : There are xmlsn= namespaces cluttering up the root node that I can't get rid of. I tried a few tricks in web searches but it changes nothing. Anyone know how to get rid of them and get plain XML? My next hurdle is a POST to create a record. The Request below actually works, but after hours of suffering I overcame two really weird problems to make it work, otherwise you get the dreaded 500 error: *PROBLEM-2* : The XML property elements have to be in alphabetical order (no kidding!!). They are not in order inside the class. *PROBLEM-3* : Related to No.1, I have to put the tedious namespaces in the root element. Greg K POST http://raven/authapi/user/create HTTP/1.1 Content-Type: text/xml Accept: application/xml Host: raven ApiUser xmlns:i=http://www.w3.org/2001/XMLSchema-instance; xmlns= http://schemas.datacontract.org/2004/07/RCS.AuthService.RestApi; Namemax/Name PasswordT0pSecret/Password SpokenNameMax Headroom/SpokenName /ApiUser
Re: Web API weird problems
I tried the first of these but it didn't work for me. YMMV On 17 January 2014 21:56, David Burstin david.burs...@gmail.com wrote: Hi Greg, Have you looked at either of the solutions in http://stackoverflow.com/questions/12590801/remove-namespace-in-xml-from-asp-net-web-api Cheers Dave On 17 January 2014 21:25, Davy Jones djones...@gmail.com wrote: For problem 2: get codemaid plugin or resharper and reorder your properties: Or you could use an xslt to transform your serialization ordering your properties as you go. Davy. Sent from my starfleet datapad. On 17 janv. 2014, at 09:43, Greg Keogh g...@mira.net wrote: Is anyone in here using Web API in anger? I'm experimenting with creating an API that is simple and easy for non .NET clients to use. Controller methods that return classes serialised as XML contain everything I expect but... *PROBLEM 1* : There are xmlsn= namespaces cluttering up the root node that I can't get rid of. I tried a few tricks in web searches but it changes nothing. Anyone know how to get rid of them and get plain XML? My next hurdle is a POST to create a record. The Request below actually works, but after hours of suffering I overcame two really weird problems to make it work, otherwise you get the dreaded 500 error: *PROBLEM-2* : The XML property elements have to be in alphabetical order (no kidding!!). They are not in order inside the class. *PROBLEM-3* : Related to No.1, I have to put the tedious namespaces in the root element. Greg K POST http://raven/authapi/user/create HTTP/1.1 Content-Type: text/xml Accept: application/xml Host: raven ApiUser xmlns:i=http://www.w3.org/2001/XMLSchema-instance; xmlns= http://schemas.datacontract.org/2004/07/RCS.AuthService.RestApi; Namemax/Name PasswordT0pSecret/Password SpokenNameMax Headroom/SpokenName /ApiUser
Re: Web API weird problems
The first thing I did was remove the XML serializer. The json took over as default and then I changed the json formatter(I think it's called) to the camel case formatter. Works nicely. On Friday, January 17, 2014, David Burstin david.burs...@gmail.com wrote: I tried the first of these but it didn't work for me. YMMV On 17 January 2014 21:56, David Burstin david.burs...@gmail.comjavascript:_e({}, 'cvml', 'david.burs...@gmail.com'); wrote: Hi Greg, Have you looked at either of the solutions in http://stackoverflow.com/questions/12590801/remove-namespace-in-xml-from-asp-net-web-api Cheers Dave On 17 January 2014 21:25, Davy Jones djones...@gmail.comjavascript:_e({}, 'cvml', 'djones...@gmail.com'); wrote: For problem 2: get codemaid plugin or resharper and reorder your properties: Or you could use an xslt to transform your serialization ordering your properties as you go. Davy. Sent from my starfleet datapad. On 17 janv. 2014, at 09:43, Greg Keogh g...@mira.netjavascript:_e({}, 'cvml', 'g...@mira.net'); wrote: Is anyone in here using Web API in anger? I'm experimenting with creating an API that is simple and easy for non .NET clients to use. Controller methods that return classes serialised as XML contain everything I expect but... *PROBLEM 1* : There are xmlsn= namespaces cluttering up the root node that I can't get rid of. I tried a few tricks in web searches but it changes nothing. Anyone know how to get rid of them and get plain XML? My next hurdle is a POST to create a record. The Request below actually works, but after hours of suffering I overcame two really weird problems to make it work, otherwise you get the dreaded 500 error: *PROBLEM-2* : The XML property elements have to be in alphabetical order (no kidding!!). They are not in order inside the class. *PROBLEM-3* : Related to No.1, I have to put the tedious namespaces in the root element. Greg K POST http://raven/authapi/user/create HTTP/1.1 Content-Type: text/xml Accept: application/xml Host: raven ApiUser xmlns:i=http://www.w3.org/2001/XMLSchema-instance; xmlns= http://schemas.datacontract.org/2004/07/RCS.AuthService.RestApi; Namemax/Name PasswordT0pSecret/Password SpokenNameMax Headroom/SpokenName /ApiUser
Re: Web API weird problems
Have you looked at either of the solutions in http://stackoverflow.com/questions/12590801/remove-namespace-in-xml-from-asp-net-web-api First part doesn't work, second part will require unpaid research time (as usual) -- Greg
Re: Web API weird problems
The first thing I did was remove the XML serializer. Reverse that here ... I removed the Jason serialiser and only want the XML serialiser. As far as I'm concerned, Json is a polluting blight on us all. The C++ coding guys consuming my Web API will wet their pants if I tell them there's another standard they have to deal with -- Greg
Re: Web API Debugging
Hi Greg, Glad you got it fixed. I had tried multiple different approaches to try to replicate your problem, but just couldn't find anything helpful. Happy New Year mate. Cheers Dave Sent from my flux capacitor. Please excuse brevity and any odd autocorrect errors. On 15/01/2014 1:33 PM, Greg Keogh g...@mira.net wrote: I accidentally solved the problem of how to debug and break a Web API app in Visual Studio. I had to add a plain htm file to the project so I could redirect there for help when a bad url was requested. That bit of controller code looks like this, just in case it's of interest: string authority = Request.RequestUri.GetLeftPart(UriPartial.Authority); string url = string.Format({0}/{1}AuthApiHelp.htm, authority, Request.RequestUri.Segments[1]); return Redirect(url); I set the htm file in Set as Start Page and when I hit F5 it fires up with that page open, but I can do all the usual debugging. D'Oh, why didn't I do that before? Greg K
Re: Web api
Really? the only way to call Rest API's is with a third party add on? I was kind of looking for the out of the box way. But will have a look at RestSharp, always handy to know whats out there. They invent this stuff faster than anyone can learn it all. :) On Fri, Feb 1, 2013 at 2:53 PM, Mark Thompson matho...@internode.on.netwrote: You might like to try something like RestSharp ( http://restsharp.org/ ) – it has some very nice helpers for adding request parameters and additional headers. I haven’t used it extensively, but for the times I have used it, it made the whole process pretty painless. ** ** Regards, Mark. ** ** *From:* ozdotnet-boun...@ozdotnet.com [mailto: ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Stephen Price *Sent:* Friday, 1 February 2013 4:38 PM *To:* ozDotNet *Subject:* Web api ** ** Hey all, ** ** While we are on the subject of MVC, I was looking about for an example or walkthrough of how you might call a Rest Web API from an MVC app. ** ** Not found much so far. I found a console C# app that uses the Asp.Net Web API Client libraries to call one. I've also found some examples of how to write the Web API's using MVC. ** ** So am scratching my head.. what httpX namespace is the right one to use? HttpClient? something else? ** ** cheers, Stephen
Re: Web api
WebAPI are just normal urls like web pages. You can call using HttpClient http://msdn.microsoft.com/en-us/library/system.net.http.httpclient.aspx On Fri, Feb 1, 2013 at 7:15 PM, Stephen Price step...@perthprojects.comwrote: Really? the only way to call Rest API's is with a third party add on? I was kind of looking for the out of the box way. But will have a look at RestSharp, always handy to know whats out there. They invent this stuff faster than anyone can learn it all. :) On Fri, Feb 1, 2013 at 2:53 PM, Mark Thompson matho...@internode.on.netwrote: You might like to try something like RestSharp ( http://restsharp.org/ ) – it has some very nice helpers for adding request parameters and additional headers. I haven’t used it extensively, but for the times I have used it, it made the whole process pretty painless. ** ** Regards, Mark. ** ** *From:* ozdotnet-boun...@ozdotnet.com [mailto: ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Stephen Price *Sent:* Friday, 1 February 2013 4:38 PM *To:* ozDotNet *Subject:* Web api ** ** Hey all, ** ** While we are on the subject of MVC, I was looking about for an example or walkthrough of how you might call a Rest Web API from an MVC app. ** ** Not found much so far. I found a console C# app that uses the Asp.Net Web API Client libraries to call one. I've also found some examples of how to write the Web API's using MVC. ** ** So am scratching my head.. what httpX namespace is the right one to use? HttpClient? something else? ** ** cheers, Stephen
RE: Web api
Absolutely, there's nothing locking you into using a third-party tool to access a REST endpoint. For me RestSharp had too many nice features in it that made it an easy decision for me to justify using, but YMMV. NuGet also makes it nice and easy to add this stuff to your projects, but it's also easy to go overboard sometimes and bloat an otherwise simple solution with a dozen different frameworks. From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Craig van Nieuwkerk Sent: Friday, 1 February 2013 7:10 PM To: ozDotNet Subject: Re: Web api WebAPI are just normal urls like web pages. You can call using HttpClient http://msdn.microsoft.com/en-us/library/system.net.http.httpclient.aspx On Fri, Feb 1, 2013 at 7:15 PM, Stephen Price step...@perthprojects.com wrote: Really? the only way to call Rest API's is with a third party add on? I was kind of looking for the out of the box way. But will have a look at RestSharp, always handy to know whats out there. They invent this stuff faster than anyone can learn it all. :) On Fri, Feb 1, 2013 at 2:53 PM, Mark Thompson matho...@internode.on.net wrote: You might like to try something like RestSharp ( http://restsharp.org/ ) - it has some very nice helpers for adding request parameters and additional headers. I haven't used it extensively, but for the times I have used it, it made the whole process pretty painless. Regards, Mark. From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Stephen Price Sent: Friday, 1 February 2013 4:38 PM To: ozDotNet Subject: Web api Hey all, While we are on the subject of MVC, I was looking about for an example or walkthrough of how you might call a Rest Web API from an MVC app. Not found much so far. I found a console C# app that uses the Asp.Net Web API Client libraries to call one. I've also found some examples of how to write the Web API's using MVC. So am scratching my head.. what httpX namespace is the right one to use? HttpClient? something else? cheers, Stephen
Re: Web api
.net client: httpclient Webpage: ajax get/post On 1 Feb 2013 18:16, Stephen Price step...@perthprojects.com wrote: Really? the only way to call Rest API's is with a third party add on? I was kind of looking for the out of the box way. But will have a look at RestSharp, always handy to know whats out there. They invent this stuff faster than anyone can learn it all. :) On Fri, Feb 1, 2013 at 2:53 PM, Mark Thompson matho...@internode.on.netwrote: You might like to try something like RestSharp ( http://restsharp.org/ ) – it has some very nice helpers for adding request parameters and additional headers. I haven’t used it extensively, but for the times I have used it, it made the whole process pretty painless. ** ** Regards, Mark. ** ** *From:* ozdotnet-boun...@ozdotnet.com [mailto: ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Stephen Price *Sent:* Friday, 1 February 2013 4:38 PM *To:* ozDotNet *Subject:* Web api ** ** Hey all, ** ** While we are on the subject of MVC, I was looking about for an example or walkthrough of how you might call a Rest Web API from an MVC app. ** ** Not found much so far. I found a console C# app that uses the Asp.Net Web API Client libraries to call one. I've also found some examples of how to write the Web API's using MVC. ** ** So am scratching my head.. what httpX namespace is the right one to use? HttpClient? something else? ** ** cheers, Stephen
RE: SPAM-LOW Re: Web api
HttpClient as already suggested but, the framework does suffer from a myriad of choices (mostly due to historical choices). HttpWebRequest can do it too, any number of proxies as well. Or you can go lower level but I would suggest getting familiar with HttpClient. That way of working is the way things will get done in the future (imho). - Glav From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Heinrich Breedt Sent: Friday, 1 February 2013 8:08 PM To: ozDotNet Subject: SPAM-LOW Re: Web api .net client: httpclient Webpage: ajax get/post On 1 Feb 2013 18:16, Stephen Price step...@perthprojects.com mailto:step...@perthprojects.com wrote: Really? the only way to call Rest API's is with a third party add on? I was kind of looking for the out of the box way. But will have a look at RestSharp, always handy to know whats out there. They invent this stuff faster than anyone can learn it all. :) On Fri, Feb 1, 2013 at 2:53 PM, Mark Thompson matho...@internode.on.net mailto:matho...@internode.on.net wrote: You might like to try something like RestSharp ( http://restsharp.org/ ) - it has some very nice helpers for adding request parameters and additional headers. I haven't used it extensively, but for the times I have used it, it made the whole process pretty painless. Regards, Mark. From: ozdotnet-boun...@ozdotnet.com mailto:ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com mailto:ozdotnet-boun...@ozdotnet.com ] On Behalf Of Stephen Price Sent: Friday, 1 February 2013 4:38 PM To: ozDotNet Subject: Web api Hey all, While we are on the subject of MVC, I was looking about for an example or walkthrough of how you might call a Rest Web API from an MVC app. Not found much so far. I found a console C# app that uses the Asp.Net Web API Client libraries to call one. I've also found some examples of how to write the Web API's using MVC. So am scratching my head.. what httpX namespace is the right one to use? HttpClient? something else? cheers, Stephen
RE: Web api
You might like to try something like RestSharp ( http://restsharp.org/ ) - it has some very nice helpers for adding request parameters and additional headers. I haven't used it extensively, but for the times I have used it, it made the whole process pretty painless. Regards, Mark. From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Stephen Price Sent: Friday, 1 February 2013 4:38 PM To: ozDotNet Subject: Web api Hey all, While we are on the subject of MVC, I was looking about for an example or walkthrough of how you might call a Rest Web API from an MVC app. Not found much so far. I found a console C# app that uses the Asp.Net Web API Client libraries to call one. I've also found some examples of how to write the Web API's using MVC. So am scratching my head.. what httpX namespace is the right one to use? HttpClient? something else? cheers, Stephen