Restful WebAPI VS Regular Controllers
Posted
by
Rohan Büchner
on Programmers
See other posts from Programmers
or by Rohan Büchner
Published on 2013-10-30T13:15:31Z
Indexed on
2013/10/30
16:11 UTC
Read the original article
Hit count: 322
I'm doing some R&D on what seems like a very confusing topic, I've also read quite a few of the other SO questions, but I feel my question might be unique enough to warrant me asking. We've never developed an app using pure WebAPI.
We're trying to write a SPA style app, where the back end is fully decoupled from the front end code
Assuming our service does not know anything about who is accessing/consuming it:
WebAPI seems like the logical route to serve data, as opposed to using the standard MVC controllers, and serving our data via an action result and converting it to JSON. This to me at least seems like an MC design... which seems odd, and not what MVC was meant for. (look mom... no view)
What would be considered normal convention in terms of performing action(y) calls?
My sense is that my understanding of WebAPI is incorrect.
The way I perceive WebAPI, is that its meant to be used in a CRUD sense, but what if I want to do something like: "InitialiseMonthEndPayment".... Would I need to create a WebAPI controller, called InitialiseMonthEndPaymentController, and then perform a POST... Seems a bit weird, as opposed to a MVC controller where i can just add a new action on the MonthEnd controller called InitialisePayment.
Or does this require a mindset shift in terms of design?
Any further links on this topic will be really useful, as my fear is we implement something that might be weird an could turn into a coding/maintenance concern later on?
© Programmers or respective owner