RoR noob is here ... :)
I need to create a Rails API that clients can call and send an XML file through a POST request.
I created my route as follows:
namespace :api do
namespace :v1 do
resource :report
end
end
and my controller:
class Api::V1::ReportsController < ApplicationController
respond_to :xml
def create
@report_submission = ReportSubmission.create :login => params[:login],
:status => :success
respond_with(@report_submission)
end
end
What do I need to do in the controller to get the XML file that will be sent by the client, and then read the contents so that I can eventually put it in the database?
How can I check this?
I created a sandbox project to try it and stuck ... I don’t know what to do next. I clicked here:
https://github.com/claudiolassala/api-samples/
Any help would be amazing! end
source
share