Set site preset on creation with REST API

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

Set site preset on creation with REST API

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.

3 Replies
Master

Re: Set site preset on creation with REST API

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.

Highlighted
Master

Re: Set site preset on creation with REST API

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.

Highlighted
Member II

Re: Set site preset on creation with REST API

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#.