08-15-2012 02:38 PM
Add comment
Add a new comment to a node.
POST /alfresco/service/api/node/{store_type}/{store_id}/{id}/comments
In my case, i use this format: /alfresco/service/api/node/workspace/SpacesStore/4eb045b7-8b0c-4799-9b8b-xxxxxxxxxx/comments
{
"title" : "title",
"content" : "content"
}
HTTP/1.1 500 Internal Server Error
09-13-2012 04:57 AM
http://localhost:8080/alfresco/s/slingshot/doclib/doclist/doclib/site/{your site id}/documentLibrary?filter=favourites
{
"totalRecords": 2,
"startIndex": 0,
"metadata": {
"repositoryId": "1b8980cc-1f1b-4ac3-b26f-17aeee0cefc9",
"container": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b",
"parent": { },
"onlineEditing": false,
"itemCounts": {
"folders": 0,
"documents": 2
}
},
"items": [
{
"nodeRef": "workspace://SpacesStore/7bb9c846-fcc5-43b5-a893-39e46ebe94d4",
"nodeType": "cm:content",
"type": "document",
"mimetype": "image/jpeg",
"isFolder": false,
"isLink": false,
"fileName": "coins.JPG",
"displayName": "coins.JPG",
"status": "",
"title": "coins.JPG",
"description": "OLYMPUS DIGITAL CAMERA",
"author": "",
"createdOn": "2011-03-03T10:34:52.092Z",
"createdBy": "Alice Beecher",
"createdByUser": "abeecher",
"modifiedOn": "2012-08-15T23:03:01.642+01:00",
"modifiedBy": "Administrator",
"modifiedByUser": "admin",
"lockedBy": "",
"lockedByUser": "",
"size": "501641",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/7bb9c846-fcc5-43b5-a893-39e46ebe94d4/coins.JPG",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Agency%20Files/Images/coins.JPG",
"actionSet": "document",
"tags": [ ],
"activeWorkflows": "",
"isFavourite": true,
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "1b8980cc-1f1b-4ac3-b26f-17aeee0cefc9",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/Agency Files/Images",
"file": "coins.JPG",
"parent": {
"nodeRef": "workspace://SpacesStore/880a0f47-31b1-4101-b20b-4d325e54e8b1"
}
},
"exif": {
"dateTimeOriginal": "2003-09-23T15:55:24.000+01:00",
"pixelXDimension": 1120,
"pixelYDimension": 840,
"exposureTime": 0.003125,
"fNumber": 9,
"flash": false,
"focalLength": 22,
"isoSpeedRatings": "80",
"manufacturer": "OLYMPUS OPTICAL CO.,LTD",
"model": "E-10",
"software": "Adobe Photoshop CS5 Macintosh",
"orientation": 1,
"xResolution": 72,
"yResolution": 72,
"resolutionUnit": "Inch"
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"permissions": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"create": true
}
},
"custom": { },
"actionLabels": { }
},
{
"nodeRef": "workspace://SpacesStore/74cd8a96-8a21-47e5-9b3b-a1b3e296787d",
"nodeType": "cm:content",
"type": "document",
"mimetype": "image/jpeg",
"isFolder": false,
"isLink": false,
"fileName": "graph.JPG",
"displayName": "graph.JPG",
"status": "",
"title": "graph.JPG",
"description": "",
"author": "",
"createdOn": "2011-03-03T10:34:52.102Z",
"createdBy": "Alice Beecher",
"createdByUser": "abeecher",
"modifiedOn": "2011-03-03T10:34:52.102Z",
"modifiedBy": "Alice Beecher",
"modifiedByUser": "abeecher",
"lockedBy": "",
"lockedByUser": "",
"size": "342155",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/74cd8a96-8a21-47e5-9b3b-a1b3e296787d/graph.JPG",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Agency%20Files/Images/graph.JPG",
"actionSet": "document",
"tags": [ ],
"activeWorkflows": "",
"isFavourite": true,
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "1b8980cc-1f1b-4ac3-b26f-17aeee0cefc9",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/Agency Files/Images",
"file": "graph.JPG",
"parent": {
"nodeRef": "workspace://SpacesStore/880a0f47-31b1-4101-b20b-4d325e54e8b1"
}
},
"exif": {
"dateTimeOriginal": "2003-12-30T15:17:54.000Z",
"pixelXDimension": 1000,
"pixelYDimension": 664,
"exposureTime": 0.0055555555555556,
"fNumber": 6.3,
"flash": false,
"focalLength": 230,
"isoSpeedRatings": "100",
"manufacturer": "PENTAX Corporation",
"model": "PENTAX K20D",
"software": "Adobe Photoshop CS5 Macintosh",
"orientation": 1,
"xResolution": 72,
"yResolution": 72,
"resolutionUnit": "Inch"
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"permissions": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"create": true
}
},
"custom": { },
"actionLabels": { }
}
]
}
09-13-2012 01:27 PM
I'm not clear on what URL you are hitting and the difference between what you are expecting to come back and what is actually coming back. When you make the favorite post, you will get back information about that node only, not all favorites. If what you want is a list of all favorites, you need to make a call like this:http://localhost:8080/alfresco/s/slingshot/doclib/doclist/doclib/site/{your site id}/documentLibrary?filter=favourites
which will return a list of favorites, like this:{
"totalRecords": 2,
"startIndex": 0,
"metadata": {
"repositoryId": "1b8980cc-1f1b-4ac3-b26f-17aeee0cefc9",
"container": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b",
"parent": { },
"onlineEditing": false,
"itemCounts": {
"folders": 0,
"documents": 2
}
},
"items": [
{
"nodeRef": "workspace://SpacesStore/7bb9c846-fcc5-43b5-a893-39e46ebe94d4",
"nodeType": "cm:content",
"type": "document",
"mimetype": "image/jpeg",
"isFolder": false,
"isLink": false,
"fileName": "coins.JPG",
"displayName": "coins.JPG",
"status": "",
"title": "coins.JPG",
"description": "OLYMPUS DIGITAL CAMERA",
"author": "",
"createdOn": "2011-03-03T10:34:52.092Z",
"createdBy": "Alice Beecher",
"createdByUser": "abeecher",
"modifiedOn": "2012-08-15T23:03:01.642+01:00",
"modifiedBy": "Administrator",
"modifiedByUser": "admin",
"lockedBy": "",
"lockedByUser": "",
"size": "501641",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/7bb9c846-fcc5-43b5-a893-39e46ebe94d4/coins.JPG",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Agency%20Files/Images/coins.JPG",
"actionSet": "document",
"tags": [ ],
"activeWorkflows": "",
"isFavourite": true,
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "1b8980cc-1f1b-4ac3-b26f-17aeee0cefc9",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/Agency Files/Images",
"file": "coins.JPG",
"parent": {
"nodeRef": "workspace://SpacesStore/880a0f47-31b1-4101-b20b-4d325e54e8b1"
}
},
"exif": {
"dateTimeOriginal": "2003-09-23T15:55:24.000+01:00",
"pixelXDimension": 1120,
"pixelYDimension": 840,
"exposureTime": 0.003125,
"fNumber": 9,
"flash": false,
"focalLength": 22,
"isoSpeedRatings": "80",
"manufacturer": "OLYMPUS OPTICAL CO.,LTD",
"model": "E-10",
"software": "Adobe Photoshop CS5 Macintosh",
"orientation": 1,
"xResolution": 72,
"yResolution": 72,
"resolutionUnit": "Inch"
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"permissions": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"create": true
}
},
"custom": { },
"actionLabels": { }
},
{
"nodeRef": "workspace://SpacesStore/74cd8a96-8a21-47e5-9b3b-a1b3e296787d",
"nodeType": "cm:content",
"type": "document",
"mimetype": "image/jpeg",
"isFolder": false,
"isLink": false,
"fileName": "graph.JPG",
"displayName": "graph.JPG",
"status": "",
"title": "graph.JPG",
"description": "",
"author": "",
"createdOn": "2011-03-03T10:34:52.102Z",
"createdBy": "Alice Beecher",
"createdByUser": "abeecher",
"modifiedOn": "2011-03-03T10:34:52.102Z",
"modifiedBy": "Alice Beecher",
"modifiedByUser": "abeecher",
"lockedBy": "",
"lockedByUser": "",
"size": "342155",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/74cd8a96-8a21-47e5-9b3b-a1b3e296787d/graph.JPG",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Agency%20Files/Images/graph.JPG",
"actionSet": "document",
"tags": [ ],
"activeWorkflows": "",
"isFavourite": true,
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "1b8980cc-1f1b-4ac3-b26f-17aeee0cefc9",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/Agency Files/Images",
"file": "graph.JPG",
"parent": {
"nodeRef": "workspace://SpacesStore/880a0f47-31b1-4101-b20b-4d325e54e8b1"
}
},
"exif": {
"dateTimeOriginal": "2003-12-30T15:17:54.000Z",
"pixelXDimension": 1000,
"pixelYDimension": 664,
"exposureTime": 0.0055555555555556,
"fNumber": 6.3,
"flash": false,
"focalLength": 230,
"isoSpeedRatings": "100",
"manufacturer": "PENTAX Corporation",
"model": "PENTAX K20D",
"software": "Adobe Photoshop CS5 Macintosh",
"orientation": 1,
"xResolution": 72,
"yResolution": 72,
"resolutionUnit": "Inch"
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"permissions": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"create": true
}
},
"custom": { },
"actionLabels": { }
}
]
}
Jeff
Hi, i get rating by this api:"/alfresco/service/api/node/workspace/SpacesStore/{id}/ratings"
But i can get only my RATING
How can i get all rating of file or folder?
09-14-2012 04:55 PM
jpotts-alfresco-mbp:~ jpotts$ curl -utuser1:password "http://localhost:8080/alfresco/s/api/node/workspace/SpacesStore/c20d54f9-01b6-4c80-861b-094c2246ab21..."
{
"data":
{
"nodeRef": "workspace:\/\/SpacesStore\/c20d54f9-01b6-4c80-861b-094c2246ab21",
"ratings":
{
"likesRatingScheme":
{
"rating": 1,
"appliedAt": "2012-09-14T15:50:11.812-05:00",
"appliedBy": "tuser1"
}
},
"nodeStatistics":
{
"likesRatingScheme":
{
"averageRating": 1,
"ratingsTotal": 3,
"ratingsCount": 3
},
"fiveStarRatingScheme":
{
"averageRating": -1,
"ratingsTotal": 0,
"ratingsCount": 0
}
}
}
}
That JSON contains the ratings total and the ratings count for all ratings received for a given node. If you want to do something different, you'll have to use the web script framework to create your own web script that returns exactly what you want (such as adding up the ratings received for all nodes in a given folder, or listing the ratings of individual users).Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.