As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Add comment Add a new comment to a node. POST /alfresco/service/api/node/{store_type}/{store_id}/{id}/comments
/alfresco/service/api/node/workspace/SpacesStore/4eb045b7-8b0c-4799-9b8b-xxxxxxxxxx/comments
{ "title" : "title", "content" : "content" }
HTTP/1.1 500 Internal Server Error
When you use curl to do this, here's what it looks like:curl -X POST -uadmin:admin http://localhost:8080/alfresco/s/api/node/workspace/SpacesStore/7bb9c846-fcc5-43b5-a893-39e46ebe94d4/comments -H "content-type:application/json" -d@/var/tmp/tmp.jsonWhere /var/tmp/tmp.json contains your JSON above, verbatim.This is working fine against 4.0.d. I can test it against another version if you need me to, but you should check that you are properly setting the content-type to "application/json" as that is a common problem.If it still doesn't work for you, please post the code that is making the POST.Jeff
s
alfresco/s/api/node/workspace/SpacesStore/
DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); String json = "{" + "\"title\" : \"" + title + "\"," + "\"content\" : \"" + content+ "\"" + "}"; StringEntity requestEntity = new StringEntity(json, "UTF-8"); httppost.setEntity(requestEntity); httppost.setHeader("Content-type", "application/json'"); Log.i("executing request" , String.valueOf(httppost.getRequestLine())); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); System.out.println("—————————————-"); System.out.println(response.getStatusLine()); if (entity != null) { Log.i("response content length:", entity.getContentLength() + ""); json = EntityUtils.toString(entity); Log.i("response content:" , json); response.getEntity().consumeContent(); } // When HttpClient instance is no longer needed, // shut down the connection manager to ensure // immediate deallocation of all system resources httpclient.getConnectionManager().shutdown();
{ "status" : { "code" : 500, "name" : "Internal Error", "description" : "An error inside the HTTP server which prevented it from fulfilling the request." },
Sorry, didn't mean to confuse you by using "s". It is a shortcut. It is equivalent to using "service".I notice a strange single-quote after your content-type string:httppost.setHeader("Content-type", "application/json'");Can you check that?
DELETE /api/comment/node/{store_type}/{store_id}/{id} <= HTTP status
{ "item": { "url": "api/comment/node/workspace\/SpacesStore\/5d3f51f1-b868-40e3-80c9-890c97061d7d", "nodeRef": "workspace://SpacesStore/5d3f51f1-b868-40e3-80c9-890c97061d7d", "name": "comment-1345137429134", "title": "title", "content": "content", "author": { "username": "admin", "firstName": "Administrator", "lastName": "" }, "createdOn": "Aug 16 2012 12:17:09 GMT-0500 (CDT)", "modifiedOn": "Aug 16 2012 12:17:09 GMT-0500 (CDT)", "createdOnISO": "2012-08-16T12:17:09.136-05:00", "modifiedOnISO": "2012-08-16T12:17:09.136-05:00", "isUpdated": false, "permissions": { "edit": true, "delete": true } } }
curl -X DELETE -uadmin:admin http://localhost:8080/alfresco/s/api/node/workspace/SpacesStore/5d3f51f1-b868-40e3-80c9-890c97061d7d
When you post the comment you'll get JSON back that looks something like this:{ "item": { "url": "api/comment/node/workspace\/SpacesStore\/5d3f51f1-b868-40e3-80c9-890c97061d7d", "nodeRef": "workspace://SpacesStore/5d3f51f1-b868-40e3-80c9-890c97061d7d", "name": "comment-1345137429134", "title": "title", "content": "content", "author": { "username": "admin", "firstName": "Administrator", "lastName": "" }, "createdOn": "Aug 16 2012 12:17:09 GMT-0500 (CDT)", "modifiedOn": "Aug 16 2012 12:17:09 GMT-0500 (CDT)", "createdOnISO": "2012-08-16T12:17:09.136-05:00", "modifiedOnISO": "2012-08-16T12:17:09.136-05:00", "isUpdated": false, "permissions": { "edit": true, "delete": true } } }That nodeRef is the nodeRef of the comment node. So you can make a DELETE call using that, like this:curl -X DELETE -uadmin:admin http://localhost:8080/alfresco/s/api/node/workspace/SpacesStore/5d3f51f1-b868-40e3-80c9-890c97061d7d
"/alfresco/service/api/node/workspace/SpacesStore/{id}/ratings"
The favorites is used to mark a document as a favorite. In the UI it shows as a filled in star and then shows up when you filter on favorites.[img]http://i.imgur.com/yVBPF.png[/img]To mark a document as a favorite, you POST to:http://localhost:8080/alfresco/s/api/people/{user id}/preferencesThe following JSON:{"org":{"alfresco":{"share":{"documents":{"favourites":"{node ref of the favorite document"}}}}}Where "node ref of the favorite document" looks like: workspace://SpacesStore/1a0b110f-1e09-4ca2-b367-fe25e4964a4eJeff
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": { } } ] }
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=favouriteswhich 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 RATINGHow can i get all rating of file or folder?
jpotts-alfresco-mbp:~ jpotts$ curl -utuser1:password "http://localhost:8080/alfresco/s/api/node/workspace/SpacesStore/c20d54f9-01b6-4c80-861b-094c2246ab21/ratings" { "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 } } } }