AnsweredAssumed Answered

Trouble creating a folder via web script

Question asked by mikew on Nov 20, 2008
Latest reply on Jun 30, 2014 by kaynezhang
I’m attempting to write a very simple proof of concept stand-alone java program that communicates directly with a remote Alfresco server (3.0b) via web scripts. The program will, hopefully, recreate a local directory structure and upload local files into it. I am running into problems, specifically with http POST requests.

I am having no problems getting Alfresco tickets using login web script and no problem performing GET requests to:
GET /alfresco/service/api/path/{store_type}/{store_id}/{id}/descendants
to list the directory contents.

However, I am receiving a 400 response when I change the method to POST (either in code or via a form in an html page.)… with the message "Posting of media resource not supported"
POST /alfresco/service/api/path/{store_type}/{store_id}/{id}/descendants

I have been looking for guidance and inspiration here:
/alfresco/service/script/org/alfresco/repository/store/descendants.post

There are two js files listed:
File: org/alfresco/repository/store/descendants.post.atom.js
File: org/alfresco/repository/store/descendants.post.js

I'm guessing I'm hitting the latter (It issues a 400 response with the previously mentioned message) rather than the previous, which actually does the directory creation.

I'm also guessing I'm either taking the wrong approach entirely, or not constructing the POST request correctly (GET to the same URL returns a list of documents in the specified location).

My first question is: is this possible? If so, how would a POST request be constructed? I figure there must be some content in the POST (parameters: title or name, alf_ticket, typeId???)

Sorry if I'm missing something obvious, but any help or guidance would be appreciated.

Outcomes