I found some posts below,but that can not work for my case.
How to create a REST API for a Ruby application?
But they all telling to use Sinatra instead of Rails framework
But, That is not possible in my application,as It is bigger and most of the part is using Rails features.
Server Application Programming Interface (SAPI) is a part my application . application is wast and most of the part is already developed in Rails.
Can anybody help me how should I create Server Application Programming Interface (SAPI) using Rails?
It depends on operation you want your API allows to do.
For example there is gem inherited_resources for RoR that generate resource methods for models.
You just need to create such controller:
and now you have API methods that can create, read, update and destroy records in your Projects table, and support two formats xml and json!
I think it is very convenient, but it depends on your purposes.