cancel
Showing results for 
Search instead for 
Did you mean: 

Can create site from share UI, not from command line.

jocylincouch
Champ in-the-making
Champ in-the-making
Using OOTB Alfresco 5 Community edition running on Ubuntu14.04

Steps: Create site through the share UI. Copy request as curl from Chromium developer tools. Reconstructed request in python requests library as:

s=requests.post('http://<IP>:8080/share/service/modules/create-site',data=site_data,cookies=THE_cookie

Where THE_cookie was obtained via a POST to http://:8080/share/page/dologin, which gave a 200, and site_data has different names to the site created through the share UI.

That request gave a 500 error stating that

u'freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:\n==> success  [in template "org/alfresco/modules/create-site.post.json.ftl" at line 2, column 17]\n\nTip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??\n\nThe failing instruction:\n==> ${success?string}  [in template "org/alfresco/modules/create-site.post.json.ftl" at line 2, column 15]', …

When in Chromium, there is no response, but a site is created successfully.

I've also not got the curl request from the command line to work – it needs the CSRF token removed, then gives a 200 and does nothing; no logs. My understanding is that Alfresco always gives a 200 on a successful request regardless of whether it's a GET or POST.

If anyone has any ideas that would be amazing. There doesn't seem to be anything that we can do to get create-site to work outside of the share UI, but we absolutely need it to do so. I know I've asked this on StackExchange, however there have been no answers and I have spent some considerable time going through the code.
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
Unfortunatly creating a site is a two step process and only half the site is created on the back end.   There are JIRAs and discussions in these forums about this.

However the bottom line is that although it is not as straightforward as it should be it is possible.

jocylincouch
Champ in-the-making
Champ in-the-making
I've just attempted again but editting the share-config-custom.xml to allow requests from outside of a browser with no CSRF token (as per https://forums.alfresco.com/comment/140283#comment-140283 – see the comment near the bottom), however the problem still manifests. The only ticket I can find that's relevant is https://issues.alfresco.com/jira/browse/MNT-11706?jql=text%20~%20%22create-site%22 which currently has no resolution. Can you point out any that do show a resolution/workaround? I just can't believe that this doesn't work OOTB.