cancel
Showing results for 
Search instead for 
Did you mean: 

Error 500 from POST request to sites api

jocylincouch
Champ in-the-making
Champ in-the-making
I'm trying to POST to the sites api to create a site (obviously :-))
I'm posting the following: payload={'description':'This categorises the meat', 'visibility':'PUBLIC', 'site-preset':'site-dashboard','title':'Meat Patch', "site.shortName":'meat-patch'}

as: requests.post('http://<my url>:8080/alfresco/service/api/sites', auth=('admin','XXXXX'), data=json.dumps(payload))

in python. I get back a 500 error detailed below. What else do I need to add to the request to get this to work? I can't find the docs which define the headers further than http://docs.alfresco.com/3.4/references/RESTful-SiteSitesPost.html and I've been using this example:https://forums.alfresco.com/forum/developer-discussions/alfresco-api/create-site-alfresco-using-open... however defining much more than is there.

The below clearly states that site.shortName is not defined, therefore how should I define shortName in the json I pass to the sites api so that the alfresco sites api pick it up? References to docs are also very very welcome.

Error log below:
{u'callstack': [u'',
  u'freemarker.core.InvalidReferenceException: Expression site.shortName is undefined on line 9, column 56 in org/alfresco/repository/site/site.lib.ftl.',
  u'freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)',
  u'freemarker.core.Expression.getStringValue(Expression.java:118)',
  u'freemarker.core.AddConcatExpression._getAsTemplateModel(AddConcatExpression.java:98)',
  u'freemarker.core.Expression.getAsTemplateModel(Expression.java:89)',
  u'freemarker.core.ListLiteral.getModelList(ListLiteral.java:119)',
  u'freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:91)',
  u'freemarker.core.Expression.getAsTemplateModel(Expression.java:89)',
  u'freemarker.core.Expression.getStringValue(Expression.java:93)',
  u'freemarker.core.DollarVariable.accept(DollarVariable.java:76)',
  u'freemarker.core.Environment.visit(Environment.java:221)',
  u'freemarker.core.MixedContent.accept(MixedContent.java:92)',
  u'freemarker.core.Environment.visit(Environment.java:221)',
  u'freemarker.core.EscapeBlock.accept(EscapeBlock.java:84)',
  u'freemarker.core.Environment.visit(Environment.java:221)',
  u'freemarker.core.MixedContent.accept(MixedContent.java:92)',
  u'freemarker.core.Environment.visit(Environment.java:221)',
  u'freemarker.core.Macro$Context.runMacro(Macro.java:172)',
  u'freemarker.core.Environment.visit(Environment.java:614)',
  u'freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)',
  u'freemarker.core.Environment.visit(Environment.java:221)',
  u'freemarker.core.Macro$Context.runMacro(Macro.java:172)',
  u'freemarker.core.Environment.visit(Environment.java:614)',
  u'freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)',
  u'freemarker.core.Environment.visit(Environment.java:221)',
  u'freemarker.core.MixedContent.accept(MixedContent.java:92)',
  u'freemarker.core.Environment.visit(Environment.java:221)',
  u'freemarker.core.Environment.process(Environment.java:199)',
  u'org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:218)',
  u'org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:896)',
  u'org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)',
  u'org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)',
  u'org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:429)',
  u'org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)',
  u'org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:491)',
  u'org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:529)',
  u'org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:341)',
  u'org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)',
  u'org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)',
  u'org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)',
  u'javax.servlet.http.HttpServlet.service(HttpServlet.java:727)',
u'org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)',
  u'org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)',
  u'org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)',
  u'org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)',
  u'org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)',
  u'org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)',
  u'org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)',
  u'org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)',
  u'org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)',
  u'org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)',
  u'org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)',
  u'org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)',
  u'org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)',
  u'org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)',
  u'org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)',
  u'org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)',
  u'org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)',
  u'org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)',
  u'org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)',
  u'java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)',
  u'java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)',
  u'java.lang.Thread.run(Thread.java:724)',
  u"org.alfresco.service.cmr.repository.TemplateException: 06020108 Error during processing of the template 'Expression site.shortName is undefined on line 9, column 56 in org/alfresco/repository/site/site.lib.ftl.'. Please contact your system administrator.",
  u'org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:222)',
  u"org.springframework.extensions.webscripts.WebScriptException: 06020018 Wrapped Exception (with status template): 06020108 Error during processing of the template 'Expression site.shortName is undefined on line 9, column 56 in org/alfresco/repository/site/site.lib.ftl.'. Please contact your system administrator.",
  u'org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1067)'],
u'exception': u"org.springframework.extensions.webscripts.WebScriptException - 06020018 Wrapped Exception (with status template): 06020108 Error during processing of the template 'Expression site.shortName is undefined on line 9, column 56 in org/alfresco/repository/site/site.lib.ftl.'. Please contact your system administrator.",
u'message': u"06020018 Wrapped Exception (with status template): 06020108 Error during processing of the template 'Expression site.shortName is undefined on line 9, column 56 in org/alfresco/repository/site/site.lib.ftl.'. Please contact your system administrator.",
u'server': u'Community v4.2.0 (r63893-b12) schema 6,033',
u'status': {u'code': 500,
  u'description': u'An error inside the HTTP server which prevented it from fulfilling the request.',
  u'name': u'Internal Error'},
u'time': u'02-Jul-2014 15:15:01'}
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
try shortName not site.shortname

jocylincouch
Champ in-the-making
Champ in-the-making
Thanks for your reply. That was the test I did after shortName failed. shortName gives the same result.