# Zoho Writer Remote API with rails

# Zoho Writer Remote API with rails

First I would like to say thanks to Arvind for answer my last mail. I feel you are trying to help me.

Just to refresh your memory, my first approach was

def openWith_zoho
@document = Document.find(params[:id])
apiKey="xxxxxxxxxxxxxxxxxxx"
url="http://export.writer.zoho.com/remotedoc.im?apikey=#{apiKey}&output=editor"
result= Net::HTTP.post_form URI.parse (url),
{ "id" => @document.id,
"url" => "http://mySite"+ (params[:path]),
"saveurl" => "http://mySite/myController/myMethodForSave/",
"filename" => @document.doc_archivo_before_type_cast,
"format" => "doc",
"persistence" => "true"
}
flash[:notice] = result.body
end
















And your suggestion was


def openWith_zoho
@document = Document.find(params[:id])
apiKey="xxxxxxxxxxxxxxxxxxx"
url="http://export.writer.zoho.com/remotedoc.im"
result= Net::HTTP.post_form URI.parse (url),
{
"apikey"=>"<<specify ur apikey>>",
"output"=>"editor",
"id" => @document.id,
"url" => "http://mySite"+ (params[:path]),
"saveurl" => "http://mySite/myController/myMethodForSave/",
"filename" => @document.doc_archivo_before_type_cast,
"format" => "doc",
"persistence" => "true"
}
flash[:notice] = result.body
end




















I tried a different approach before your answer came and it worked at least for a while I wrote a simple html post (almost nothing of Ruby or Rails methods) like the one at your API

<form method="POST" action="http://export.writer.zoho.com/remotedoc.im?apikey=xxxxxxxxx&output=editor" target= <%= @document.id %>>

<input type="hidden" name="url" value=<%= "http://mySite"+ url_for_file_column("document", "doc_archivo",:absolute => true ) %> >

<input type="hidden" name="saveurl" value= <%= "http://mySite/myController/mySave/" + (document.id.to_s)

<input type="hidden" name="filename" value=<%= @document.doc_archivo_before_type_cast %> >

<input type="hidden" name="id" value=<%= document.id %>>

<input type="hidden" name="format" value= <%= @filename.last %>>

<input type="hidden" name="persistence " value="true">

<input type="submit" value="Ver en Zoho" class="button" name="submit" >

</form>



















I saw it working with my own eyes, my friends tried it through mySite and it worked, by the way your application Rules! but now two days later it didn't work any more. The message is "Unable to import content".

I tried your suggestion, but it said "Unable to import content" to me too.

I didn't have a firewall I can send mp3 files through mySite to google mail player, mySite port is 80 I don't know what I'm doing wrong. If you have any idea I would love to hear it.

With the html form post, by the time it worked I couldn't save the file, but I was guessing it was for my lack of experience with rails, but I knew it was working because I could do things like change the title of the object with your filename answer.

Just to give you an idea my savedoc is something like this.


def savedoc
@document = Document.find(params[:id])
@document.update_attribute :doc_title, (params[:filename])
@document.update_attribute :doc_file, (params[:content])
redirect_to :action => 'list', :id => @document.coleccion_id
# #I olso tried something like
# #File.open(@document, "w")do |f|
# # f.write(params[:content]).read
# #end
# #And it replaced the .doc for a plain .txt empty with the .doc name and extension
# And something like
# f=File.new(params[:content])
end















thanks for read me

Angela Amaris

























      • Sticky Posts

      • My Zoho Story #19 - How and IT service provider, CTSP, are streamlining customer support using Zoho

        My Zoho Story is a video podcast series where we connect with Zoho users worldwide to hear from them about their experiences with Zoho and how it became an integral part of their everyday business life. Our recent 'My Zoho Story' took us to Australia
      • My Zoho Story #18- How Mirage Visual Limited achieved enhanced customer service experience, using Zoho

        My Zoho Story is a video podcast series where we connect with Zoho users worldwide to hear from them about their experiences with Zoho and how it became an integral part of their everyday business life. Our recent interview with Sam Blenkiron from Mirage
      • My Zoho Story #17 - How Superior Trucking Payroll Service scaled their business with Zoho

        My Zoho Story is a video podcast series where we connect with Zoho users worldwide to hear from them about their experiences with Zoho and how it became an integral part of their everyday business life. In our recent episode, we had the opportunity to
      • Update on the upcoming Zoho User Group meetups - Q1

        Hey Zoho Community!  How're you all doing? We have an important announcement about the Zoho User Group meetups this quarter - Owing to the looming threat of COVID - 19, we're recalling several of our ZUG meetups that can't be run locally and are pulling back our Zoho teams who have traveled for these events. We have also suspended Zoho meetups run by our local partners and user group leaders as we do not want any of our users to come in harm's way. For those of you who have not seen the email about
      • Eighth day of Christmas - Zoho Recruit

        Check out the story behind our sixth day of Christmas post. ​ The eighth day of the 12 days of Christmas relates to Zoho Recruit  "On the eighth day of Christmas my true love sent to me: eight maids a milking, seven swans a swimming, six geese a laying, five golden rings, four calling birds, three french hens, two turtle-doves, and a partridge in a pear tree." The eight maids walking up with portfolios in their hands signifies Zoho Recruit's recruitment solutions built to provide diverse, end-to-end