Calling POST webscript in ruby

cancel
Showing results for 
Search instead for 
Did you mean: 
sakshik
Established Member

Calling POST webscript in ruby

I have developed a webscript in alfresco:

/settaskstatus?taskID=491389&status=Completed

which sets status of a task based on it's ID. 

I am trying to call this web script upon click of a button in ruby(erb)

<%=button_to "Completed", "https://plxcas140.pdx.intel.com:8443/alfresco/service/settaskstatus?taskID=491389&status=Completed"%>

It shows the following error:

4 Replies
douglascrp
Advanced II

Re: Calling POST webscript in ruby

That means the webscript you created is not able to deal with the POST method.

Much probably you have only the GET method.

Can you share here the webscript's code?

Remember to share everything you have (xml, ftl, js, java, whatever)

sakshik
Established Member

Re: Calling POST webscript in ruby

Hello,

I changed the name of my script from settaskstatus.get.js to settaskstatus.post.js and then the button worked. 

Can you explain the reason behind it and what if I want to call a GET request

douglascrp
Advanced II

Re: Calling POST webscript in ruby

You can find all the explanation in the official docs here Web scripts | Alfresco Documentation 

Now, short answer to you "what if I want to call a GET request", in that case you have to configure Ruby to use the GET method instead of the POST, but for that, I have nothing to say, as I know nothing about Ruby.

It seems, by your sample code, that Ruby uses POST as default.

sakshik
Established Member

Re: Calling POST webscript in ruby

okay thanks Smiley Happy