AnsweredAssumed Answered

Using Webscript to post Topic to Forum Content Type

Question asked by rhertzberg on Oct 26, 2009
Latest reply on Nov 2, 2009 by jpotts
All -

I am attempting to develop a little javascript application that will allow me to post a topic to a discussion forum for a content item.  In doing this, I am trying to use the /alfresco/service/api/forum/node/{store_type}/{store_id}/{id}/posts webscript that is installed with Alfresco.

Here is my code (removed the callback for brevity here):


var sUrl = "/alfresco/service/api/forum/node/workspace/SpacesStore/c128f4c1-22f2-4d74-a924-a6a2dcf731fd/posts";
var data = '{"title": "This is the title", "content": "This is my post content"}';
var postData = YAHOO.lang.JSON.stringify(data);

var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);

However, I'm having some trouble getting this to work.  I continue to get an error that looks like this:

"status" : { "code" : 500, "name" : "Internal Error", "description" : "An error inside the HTTP server which prevented it from fulfilling the request." }, "message" : "09261343 Wrapped Exception (with status template): 09261342 Error during processing of the template 'Error executing macro: postJSON\nrequired parameter: postData is not specified.'. Please contact your system administrator.", "exception" : "org.alfresco.web.scripts.WebScriptException - 09261343 Wrapped Exception (with status template): 09261342 Error during processing of the template 'Error executing macro: postJSON\nrequired parameter: postData is not specified.'. Please contact your system administrator.", "callstack" : [ "" ,"freemarker.template.TemplateException: Error executing macro: postJSON\nrequired parameter: postData is not specified." …

I suspect that the problem is related to the way I am posting my content, but I can't find the "right" way to do this.  Does anyone have a quick working example that could point me in the right direction?

Thanks in Advance,
Russell

Outcomes