I want to create an API for a large ASP.NET MVC application. This application uses strongly typed viewmodels for all its views. The most important job for the API will be to enable the website's functionality on other platforms such as iPhone's Objective C.
Now the idea has been from the start to reuse the ViewModels and existing controller actions for the API, in such a way that the viewmodels are returned as JSON or Ajax results by the controller instead of the view.
But there has been some discussion about this, because viewmodels have a lot of composite information that does not always seem useful for an API. For example, a typical API function could be GetRanking(). The viewmodel belonging to the Ranking() action actually has more data, such as the name of the current user and maybe some explanation about the ranking.
So the question is, what would be the best way to approach this: write separate actions for the api and return serialized domain objects, or reuse the current actions and viewmodels, and just ignore the unneeded data?