01-09-2019 11:52 AM
Hi!
I'm trying to create a site using the REST API. Everything seems to work except when I try to set the site preset I get
400 - Site preset should not be set
I also tried using the PUT method to update the site but then I get
400 - Site update does not support field: preset
This happens with a custom preset I created and with the default site-dashboard.
JSON examples:
This works:
{
"id": "ajeje",
"title": "ajeje",
"description": "ajeje",
"visibility": "PUBLIC"
}
This doesn't:
{
"id": "ajeje",
"title": "ajeje",
"description": "ajeje",
"visibility": "PUBLIC",
"preset": "site-dashboard"
}
Is this functionality really not available?
This is in a docker installation, Share version 6.0.c, Content Repository version 6.1.1.
01-11-2019 03:24 AM
It really is not available. The check for the preset parameter is hard-coded to always throw the exception. The reason behind this is that the ReST API only know how to import / pre-construct the structure of a default site, and it offers no extensoin point to allow adding an import for an arbitrary preset. Alfresco being Alfresco, they opted for the easiest solution that would allow them to release a new feature: hard-disallowing sensible parameters to be used and not caring for people that extend Alfresco.
01-11-2019 03:25 AM
It should be noted that one can always try to enhance their implementation by providing a pull request on GitHub. That might be the most likely way to make their minimal viable features into usable ones these days.
01-21-2019 09:24 AM
If anyone is having the same issue our "solution" was to use the create-site webscript, the one that gets called when you create a site from the UI. Here is an example written in JavaScript, we did something similar in C#.
Explore our Alfresco products with the links below. Use labels to filter content by product module.