Take the 2-minute tour ×

Or is Rails by itself just good for developing APIs?

It seems that ASP.NET Web API project types have some history intertwined with WCF (as is detailed in this post for example), so maybe it's not applicable to Rails.


To clarify, Microsoft has the ASP.NET MVC framework. Recently, they came out with a framework called ASP.NET Web API. ASP.NET Web API seems to have similarities to ASP.NET MVC, but is specialized and trimmed down for RESTful web services. Is there an equivalent in the Ruby/Rails space?

share|improve this question
@kprobst is right, your question is ambiguous. API is just a way to interact with a program/service. You should probably look at RESTful and SOAP. –  Azolo Mar 23 '12 at 21:00
To clarify, Microsoft has the ASP.NET MVC framework. Recently, they came out with a framework called ASP.NET Web API. ASP.NET Web API seems to have similarities to ASP.NET MVC, but is specialized and trimmed down for RESTful web services. Is there an equivalent in the Ruby/Rails space? –  Derek Morrison Mar 23 '12 at 21:13
add comment

6 Answers

up vote 10 down vote accepted

So, the answer is Yes to both questions. Rails does have an equivalent and its Rails.

ASP.NET Web API looks like at it's heart is just a RESTful router with type negotiation. I could be totally off base here, but from the tutorials I saw that's what it looked like to me.

So yes, from what I can tell, Rails supports most of the things that the Web API was created for. In fact in Rails most of this stuff is forced onto you until you become informed enough to be able to change it (assuming by that point you know better than to actually do that).

But, as far as Web API functionality. That really comes from the ability to support HTTP verbs (GET, POST, PUT, DELETE) which Rails does.

But a source of confusion might be that in Rails the RESTful API is actually the application itself. Meaning you don't need to implement any other libraries, it's just built that way.

Here's a quick example of that I mean
When you hit /users/1 you will get the data associated with that user depending on the format you requested. So if you request JSON the controller returns JSON, HTML you get HTML, XML you get XML, etc. (As long as said format is implemented for that resource)

A good overview of what I'm talking about are in these two sections:
Rails Guides::Controller: Rendering xml and json data
Rails Guides::Routing: Resources on the Web

So you could build a website, API, or both in a Rails app and they would all start the same way.

But from my limited knowledge on the matter, I would say a ASP.NET MVC with ASP.NET Web API program is actually a lot more like a Rails Program than the regular ASP.NET MVC programs that came before them.

Or it's all just a clever ploy to get as many Capital Letters in a title as humanly possible.

share|improve this answer
Excellent answer - thanks! It all came together for me when you described how Rails answers a request based on the requested format. –  Derek Morrison Mar 27 '12 at 14:08
Hmm, having worked with both, I've got to disagree - rails is a lot more verbose and not really a good comparison. Rails has lots more features typically exposed. Sure, you can do content-type negotiation in web api, but typically, that's something the "controller" isn't that interested in, just the serializer. And rails doesn't automatically "unpack/validate" arguments nor automatically serialize return values. –  Eamon Nerbonne Oct 15 '13 at 9:20
Basically, in actual use, a rails controller method is usually some code to deal with the http-level details wrapping a conceptual method with a input/output pattern; and web api makes most of that redundant, implicitly mapping the underlying method arguments to the http-level parameters and the underlying return value to some content-negotiated serialized form. –  Eamon Nerbonne Oct 15 '13 at 9:22
Then instead of adding comments, you should add another answer. I don't doubt it would be better than my answer. I've never used Web API so I'm just going off what I understood from a glance. –  Azolo Oct 16 '13 at 15:32
add comment

Take a look at grape. It is a pure "Rest" HTTP API framework in ruby.

share|improve this answer
add comment

WSO2 looks like a generic web services framework (as opposed to MVC like Rails) I can't vouch for it but it seems to be more a service framework in the style of WCF Web API (service in the generic sense, not just SOAP).

share|improve this answer
add comment

It's difficult to know what you mean by "APIs"... Rails and ASP are used for developing web sites, and WCF is essentially a web service platform. ASP and WCF have little in common, it's just normal for ASP applications to consume WCF services because they all run on the same stack and platform.

I suppose Rails on the Microsoft side would be a combination of ASP.NET MVC, Linq2SQL or EntityFramework and some WCF.

share|improve this answer
wow, both answers downvoted to -1 in minutes. I guess I should avoid trying to help people with vague questions. –  kprobst Mar 23 '12 at 20:46
I mean whatever Microsoft means by "ASP.NET Web API" (the formal name for the project), which I think is a variation on ASP.NET MVC tailored to developing web services. –  Derek Morrison Mar 23 '12 at 21:07
Still not sure what you're talking about, sorry. ASP.NET is an "API" only in the sense that you write against it, I suppose. But I don't think that's what you mean here. –  kprobst Mar 23 '12 at 21:12
I'm talking about this specific project/framework. –  Derek Morrison Mar 23 '12 at 21:14
Ooooh, I get it now, sorry. Well, that's just a kind of RESTful layer on top of MVC4. If anything I thought it makes it easier to do Ajax stuff. You can still do that (to a certain extent) using WCF bindings, this just brings it forward to the presentation layer and makes it easier to work with. And having said that, I have no idea if there's an equivalent in Rails, but then I don't see what that has to do with WCF either. –  kprobst Mar 23 '12 at 21:19
show 1 more comment

Ok, this isn't a direct answer to your question, however there seems to be some confusion... Microsoft's ASP.NET Web API is specifically a product offering with ASP.NET MVC 4+. It is a RESTful framework. How does it compare to RoR? I don't know having never tried to install RoR on Windows. As with anything else, experiences vary... Requirements vary. Also try to think ourside the language, construct, context, and framework. Is it better for developing API's? If you're using Linux/Unix, the answer is probably a yes. If you're on a Windows server, the question is a bit trickier.


Writing in the ASP.NET Web API will have 0% to do with WCF. Perhaps it is implemented as such under the covers, but the ASP.NET Web API is (from what I've seen and done with it) strictly an HTTP bound API, not TCP/Binary/Piped/etc... like WCF. If you're ask

share|improve this answer
add comment

Yes. It's called Grails. It uses spring. There are tons of plugins available for it and it make creating webapps a breeze. Read more about it here.

share|improve this answer
add comment

Your Answer


