Add site - Add site v2
OVERVIEW
Note: the specification has been updated in Collaborate 4.3
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 now supports 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>
<sitetemplateid></sitetemplateid> (Added in Collaborate 4.1.4)
<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 201 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>
Hi James Richardson, I'm assuming because categories can be multi-value, so it's actual an array of values:
...
...
"categories": {
"category": [
{
"name": "string",
"id": "string",
}
]
},
...
...
As per Swagger documentation
Jeff Gleed were you every able to solve this? if so can you send me the correct json format?
Imran Aziz based on Jeff's change, ID is not a known property of 'categories' do you have the updated doc so i know what properties the categories object has?
I am using the documentation for Add Site V2 so I guess the answer is yes. Thanks for the update and I had guessed what the problem was as the error message said it didn't know what category was but that it did know what categories was.
Thanks Imran Aziz, maybe you should consider changing the current page too. It isn't easy to figure out to look at the site object page when I want to add a site
Jeff Gleed, Morten Fahrnholz sorry for the late response. The best way to get a quick response is to email our support team at support@highq.com, if there is a bug introduced then support is best placed to manage this.
Can you please confirm that you are calling the API with the latest version of the API or not, I would recommend using the parent page of this documentation page to get the updated documentation. Please note that we changed Collaborate so that a site can relate to multiple categories rather than one category and due to that the API had to be updated, now the category element exists under categories element as explained here
Jeff Gleed No, I'm afraid not, and nothing from HighQ either??? Imran Aziz
I am getting the same error ... did you manage to get a solution?
Hi Imran Aziz,
I'm getting errors when creating sites, it used to work ?.
url: /api/2/sites/
Payload:
{
"sitename" : "MOFTESTING 123",
"sitedescription":"Test desc",
"sitetemplateid" : "39",
"category": { "id": "11"}, //from api/2/sitecategories tried different ids like 1, 10 and 12
"startdate": "10 Apr 2019",
"enddate": "30 Apr 2019",
"type": "Matter",
"clientno": "9990090990",
"matterno": "144638",
"module": {
"home": {"enable": "0"},
"activity": {"enable": "0"},
"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)"
}
Error 400 Bad Request:
Unrecognized field "category" (class com.os.api.dbo.Site), not marked as ignorable (35 known properties: "adminnote", "matterno", "sitefolderpermission", "enddate", "clientno", "sitefolderID", "sitename", "sitedescription", "createddate", "id", "sitetemplateid", "filepagecount", "enabledmodules", "billinglastinvoicedate", "module", "billingnextinvoicedate", "folder", "rawsitesize", "status", "role", "link", "biddersite", "maxpagecount", "contactus", "isSyncable", "size", "sitehttplink", "siteowner", "startdate", "categories", "billingnotes", "file", "archiveddate", "enforceusergroups", "landingpage"])
at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 5, column: 26] (through reference chain: com.os.api.dbo.Site["category"])
Comments
9 Comments