1

I am quite new to Windows Store Apps developement and I need to consume a REST based web service.

My issue is that there has been so much movement in development technologies made for consuming modern web services during the last years, that in the end it is hard and confusing to find out what is easiest and, especially, what are the most up to date solutions to achieve that.

I want to use the Discogs API in a Windows Store Apps using C#. I only need to use GET.

Thanks.


Edit: The main reason why I ask what is the best way to consume REST services in Windows Store Apps, is because I need a solution compliant with asynchrony.

Steve Bennett
  • 114,604
  • 39
  • 168
  • 219
Ucodia
  • 7,410
  • 11
  • 47
  • 81

3 Answers3

3

Well of course there's HttpWebRequest in .NET which is adequate. If you want some abstraction there are options like RestSharp ( http://restsharp.org/ ).

evanmcdonnal
  • 46,131
  • 16
  • 104
  • 115
1

Here is a post that contains several library recommendations when consuming REST from .NET

EDIT:

However, unless you are needing something that THIS framework provides...I'd just use the API interface that is already built for you!

Community
  • 1
  • 1
Jared
  • 5,840
  • 5
  • 49
  • 83
  • The Discogs API seems great but does not seem to support asynchrony as it was built originally with C# 4.0. I made a feature request on Codeplex. – Ucodia Dec 12 '12 at 09:16
  • @Ucodia It would be a slight increase in the needed work, but could you not simply pass the work off to a thread and...in a sense make it a async request? I think building a small wrapper to accomplish the task in a thread (or simply downloading the source and modifying) would be easier then writing an entirely new API. – Jared Dec 12 '12 at 20:38
  • surely it would be quite an amount of work to make it compliant. But still I would have to write my own wrapper API to support async calls. Good thing is I only need the search feature so I won't have a lot to cover. – Ucodia Dec 12 '12 at 23:18
  • I finally gave up on DiscogsNet as it is just not compatible with WinRT. – Ucodia Dec 18 '12 at 21:44
  • Sad...Good info to have on here. Might update your original question with info like this as you get it just in case someone doesn't read these comments. – Jared Dec 18 '12 at 21:53
  • Sure I will. I am actually thinking of branching DiscogsNet to bring asynchrony and WinRT support. – Ucodia Dec 19 '12 at 00:16
  • Were you able to determine the cause of why it wouldn't run under RT? Also, this may help in the conversion... http://msdn.microsoft.com/en-us/library/windows/apps/br230232.aspx – Jared Dec 19 '12 at 00:32
  • Of course I evaluated the work before planning for branching. Basically the current API uses WebClient which needs to be migrated to HttpClient, thus bringing asynchrony support. – Ucodia Dec 19 '12 at 11:46
1

I may as well jump on board with another option: the HttpClient class would be the "out-of-the-box" recommendation in .NET 4.5 (including Windows Store Apps) for your scenario. By default, it leverages HttpWebRequest.

There's a QuickStart: Connecting using HttpClient on the Dev Center that addresses the GET scenario that should get you pretty far. And there's a full HttpClient sample as well.

Jim O'Neil
  • 23,344
  • 7
  • 42
  • 67