Comments with REST API
This section describes the REST URIs for working with the comments of a resource.
Query parameters
The following terms explain the meaning of the query parameters passed with the following REST URIs:
Parameter | Explanation |
---|---|
path | Path of the resource |
id | Identifier of the comment |
start | Start page number (optional) |
size | Number of comments to be fetched (optional) |
The {start page} and {number of records} can be any value greater than or equal to 0. The {start page} and {number of records} begin with 1. If both of them are 0, then all the comments are retrieved. Note that start and size are optional parameters and will default to 0 by default.
For details on security (the authorization header) and the URI syntax (port, context, etc.), see Registry REST API.
Get all comments on a resource
Attributes | Values |
---|---|
HTTP Method | GET |
Request URI | /comments?path={ resource path }&start={ start page }&size={ number of records } |
HTTP Request Header | Authorization: Basic { base64encoded(username:password) } |
Description | This retrieves all the comments posted on the specific resource. |
Response | HTTP 200 OK |
Response Type | application/json |
Sample request
curl -X GET -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" "https://localhost:9443/resource/1.0.0/comments?path=/_system/governance/trunk/soapservices/com/amazon/soap/1.0.0/AmazonSearchService" -i -k
Get a specific comment on a resource
Attributes | Values |
---|---|
HTTP Method | GET |
Request URI | /comment?path={ resource path }&id={ comment id } |
HTTP Request Header | Authorization: Basic { base64encoded(username:password) } |
Description | This retrieves the specific comment associated with the given comment id. |
Response | HTTP 200 OK |
Response Type | application/json |
Sample request
curl -X GET -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" "https://localhost:9443/resource/1.0.0/comment?path=/_system/governance/trunk/soapservices/com/amazon/soap/1.0.0/AmazonSearchService&id=1" -i -k
Add a comment to a resource
Attributes | Values |
---|---|
HTTP Method | POST |
Request URI | /comment?path={ resource path } |
HTTP Request Header | Authorization: Basic { base64encoded(username:password) } Content-Type: text/plain |
Payload | Comment appears in text format |
Description | Add the payload comment to the requested resource |
Response | HTTP 204 No Content |
Response Type | application/json |
Sample request
curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" -d 'Sample Comment' "https://localhost:9443/resource/1.0.0/comment?path=/_system/governance/trunk/soapservices/com/amazon/soap/1.0.0/AmazonSearchService" -i -k
Update a comment on a resource
Attributes | Values |
---|---|
HTTP Method | PUT |
Request URI | /comment?path={ resource path }&id={ comment id} |
HTTP Request Header | Authorization: Basic { base64encoded(username:password) } Content-Type: text/plain |
Payload | New comment to be updated as TEXT. |
Description | It replaces the new comment for the given comment id |
Response | HTTP 204 No Content |
Response Type | application/json |
Sample request
curl -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" -d 'Sample 123' "https://localhost:9443/resource/1.0.0/comment?path=/_system/governance/trunk/soapservices/com/amazon/soap/1.0.0/AmazonSearchService&id=2" -i -k
Delete a comment on a resource
Attributes | Values |
---|---|
HTTP Method | DELETE |
Request URI | /comment?path={ resource path }&id={ comment id} |
HTTP Request Header | Authorization: Basic { base64encoded(username:password) } |
Response | HTTP 204 No Content |
Response Type | application/json |
Sample request
curl -X DELETE -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" -d 'Sample 123 sdfsdafsdfdsfdsasdf' "https://localhost:9443/resource/1.0.0/comment?path=/_system/governance/trunk/soapservices/com/amazon/soap/1.0.0/AmazonSearchService&id=1" -i -k