pablo
pablo

Reputation: 6402

A good way to implement a REST API in C#

We've to implement a REST API to access some features of our current server, which is written in C#. So, we'd like to expose some of its functionality (currently done through TCP) using a REST API.

Can you post some pointers to the right docs and ideas about how to get it implemented?

The server is not a "aspx" server but a service app.

Upvotes: 0

Views: 8674

Answers (4)

Johnathan Kanarek
Johnathan Kanarek

Reputation: 854

First I recommend to take a look at my different REST approach.

  • Don't use nested complex paths, keep it simple flat list of services and actions.
  • Don't use custom HTTP methods, use the path to specify the action.
  • Don't use custom HTTP error codes, that will mix your applicative errors with the HTTP protocol errors and will prevent complex error codes or partial success.
  • Support multi-request, which is multiple applicative requests in each HTTP request.

I also introduce simple C# simple REST server example for your convenience.

Upvotes: 0

Regfor
Regfor

Reputation: 8091

For now primary REST technology in Microsoft stack is ASP.NET Web API http://www.asp.net/web-api (former WCF Web API)

Visit web site for ASP.NET Web API, there are a lot of tutorials on how to make it.

Upvotes: 2

dif
dif

Reputation: 2493

I have worked with a REST API in a project:

RestSharpis a simple, open source REST client for .NET designed primarily for consuming third-party HTTP APIs.

It took a lot of work out of my hands - i don't want to miss it ;-)

The Author of the Library John Sheehan is also on StackOverflow and usually helps really fast with specific problems!

Upvotes: -1

Uwe Keim
Uwe Keim

Reputation: 40726

Microsoft's MSDN contains information on how to create RESTful services with WCF.

Upvotes: 4

Related Questions