Add site - Add site v1
OVERVIEW
Note: The latest specification for Collaborate 4.1.4 and above is here
Use this API to create a new site.
The site object only supports attributes which are visible in the create site interface.
The method implementation does not support site templates.
This method does not support uploading site image in this call, the site icon support will be provided as a separate call.
The method call expects an existing category ID. The category ID should be obtained by the calling application by an earlier call to the Site categories interface.
Site start and end date should be in the format of 'dd MMM yyyy' and it is NOT UTC. API client will always request actual date.
We expect three different wordings or identifications for options in <landingpage> for Files module. Possible values are:
· files (root folder)
· files (recent activity)
· files (advanced search)
Request
POST /sites
Request XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<site>
<sitename>XMLAPITest01</sitename>
<sitedescription>This is site description</sitedescription>
<adminnote>This is admin note for Demosite</adminnote>
<category><id>1</id></category>
<startdate>20 Mar 2014</startdate>
<enddate>28 Feb 2022</enddate>
<type>Matter</type>
<clientno>100</clientno>
<matterno>300</matterno>
<module>
<home enable="1" />
<activity enable="1" />
<document enable="1" />
<wiki enable="0" />
<blog enable="0" />
<task enable="0" />
<event enable="0" />
<isheet enable="0" />
<qa enable="0" />
<people enable="0" />
</module>
<landingpage>files (root folder)</landingpage>
</site>
JSON
{
"sitename": "XMLAPITest01",
"sitedescription": "This is site description",
"adminnote": "This is admin note for Demosite",
"category": {
"id": "1"
"startdate": "20 Mar 2014",
"enddate": "28 Feb 2022",
"type": "Matter",
"clientno": "100",
"matterno": "300",
"module": {
"home": {
"enable": "1"
},
"activity": {
"enable": "1"
},
"document": {
"enable": "1"
},
"wiki": {
"enable": "0"
},
"blog": {
"enable": "0"
},
"task": {
"enable": "0"
},
"event": {
"enable": "0"
},
"isheet": {
"enable": "0"
},
"qa": {
"enable": "0"
},
"people": {
"enable": "0"
}
},
"landingpage": "files (root folder)" }
Response
The method returns a 200 OK in case of successful creation of the site. The returned XML provides the new sites ID:
<site>
<id>100</id>
<sitename>Demosite</sitename>
<link>https://clientinstance.local.com/clientinstance/api/1/sites/161</link>
</site>
The method returns an error object in case of an error.
Example error object:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error> <link>https://collab.local.com/collab_3_3_0/api/1/error/189</link> <ref>144</ref> <summary>Site name required.</summary>
</error>
Is there ability (or is it on the roadmap) to add pages to a site / wiki? For example, if I want to specify the HTML for the landing page of a site when I create the site resource?
Morten Fahrnholz I am afraid not, this is a capability we do not have in the API at the moment, but will register it as an improvement to the API.
Imran Aziz Hi Imran, about my second question, is it possible to re-activate a site through the api?
Morten Fahrnholz wonderful.
Imran Aziz Thanks, I guess we're using the newest? I'm just calling the rest api. I'll create a support ticket. Thanks
Morten Fahrnholz which version of Collaborate are you using? this feature is supported from Collaborate 4.1.4 and above. Please raise this as a support ticket if you are using the correct Collaborate version and are still getting this error. Thanks
Imran Aziz Hi again. It doesn't seem to work with a JSON request (getting error on the sitetemplateid) However the site gets created with xml request, but the template doesn't seem to get applied to the site? Here's the xml I post and get success back but no template is applied.
The JSON request error:
Unrecognized field "sitetemplateid" (Class com.os.api.dbo.Site), not marked as ignorable
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@6087bf0c; line: 1, column: 116] (through reference chain: com.os.api.dbo.Site["sitetemplateid"])
The xml post data:
Imran Aziz thanks, didn't notice that i was on the wrong site, and that the JSON example isn't updated with the property ;)..
Morten Fahrnholz this was implemented in Collaborate 4.1.4 please see the documentation for 4.1.4 here
Hi Imran, I have a couple of questions:
1.How do I select the site template when adding the site through the API? And
2.How I can re-activate a site through the API when it's bean archived earlier?
Thanks Morten
Giuseppe Carafa there is no API to get the site categories list, we will include this in a future release of Collaborate, for now, this option can only be used if you have a predefined list of categories whose ID you can obtain from the web interface.
Hello Imran,
"The method call expects an existing category ID. The category ID should be obtained by the calling application by an earlier call to the Site categories interface. "
What is the API for the "Site categories interface"? I see no obvious entry for this in the API list...
Shiva Kataksham the capability is not available in the current release of Collaborate, however we have already implemented this in Collaborate 4.1.3 which will be available in June.
Is it possible to create site based on Site template via this API call?
Shiva Kataksham I am afraid not, the User API only works at the system level and is missing the capability to add users to the site. We plan to work on this improvement in the next release of Collaborate.
Hi is there a way to add a user as site admin on site creation?
Comments
17 Comments