05-02-2018 07:05 AM
I'm using Alfresco Community - 5.2.0 (re21f2be5-b22).
I'd like to use the /people/{personId}/sites/{siteId} API.
According Alfresco Content Services REST API Explorer I should use an URL similar to
https://xxxx/alfresco/api/-default-/public/alfresco/versions/1/people/myuser/sites/MySite
My problem is:
When I use that URL (where "MySite" is my site's "shortName"), my server answers:
* <url> malformed
When I try to omit MySite I get the same result.
But if I try the old URL
https://xxxx/alfresco/service/api/people/myuser/sites
I do get a jshon with the list of sites. Incidentally, output is different from that in the documentation. There should be a "siteID" field, but my sites are listed like this:
{
"url": "\/alfresco\/service\/api\/sites\/MySite",
"sitePreset": "site-dashboard",
"shortName": "MySite",
"title": "My Site",
"description": "Foo Bar",
"node": "\/alfresco\/service\/api\/node\/workspace\/SpacesStore\/e3b7aaf8-8dca-4433-b851-8b82e55865ef",
"tagScope": "\/alfresco\/service\/api\/tagscopes\/workspace\/SpacesStore\/e3b7aaf8-8dca-4433b851-8b82e55865ef",
"siteManagers":
[
"foo",
"bar",
"foobar"
],
"isPublic": false,
"visibility": "PRIVATE"
}
That seems promising, but adding again the short name of the site
https://xxxx/alfresco/service/api/people/myuser/sites/MySite
gives
* The requested URL returned error: 404 Not Found
* Closing connection 0
So, the questions are:
I should be using the "-default-/..../versions/1" URL's or the other ones?
Why "MySite" is Not Found in my last example? Is {siteID} not the same as "shortname" ?
TIA
05-02-2018 09:57 AM
It looks like it's some problem with that Site called "MySite".
This works fine for me using 201707:
http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/people/admin/sites/MySite
Have you tried with any other site?
BTW, siteId is the same as shortname
05-03-2018 06:39 AM
Ok, nevermind. PCBK
I had a typo in my script 😞
Anyway, a question remains. It seems that starting with Alfresco 5.2 we should be using "alfresco/api/-default-/public/alfresco/versions/1".
Is that path backwards compatible? Or should be use "/alfresco/api/-default-/public/alfresco/versions/1/people/USER/sites/SID" or "/alfresco/service/api/people/USER/sites/SID" depending on the version of the server?
Thanks!
05-03-2018 08:56 AM
The one including "-default-" is the new REST API. Available only from 5.2.
The other is the traditional RESTA API. It will be removed in the future.