Comments

The operations that can be performed on the comments of a resource are:

GET /comments
POST /comments
PUT /comments
DELETE /comments
GET /comments/resource/{resourceId}
GET /comments/{commentId}

GET /comments

This API is used to fetch all comments.

Parameters

None

Example to retrieve all comments

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/comments"

Example to retrieve all comments as ldap user

curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/ comments"

Equivalent system query

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/data/query" -H "query:select * from ALL_COMMENTS" -H "standardSQL:true" -H "system:true"

Example to retrieve count of all comments

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/comments?count"

POST /comments

This API is used to add a new comment for a resource. The provided JSON should be a list of map entries whose keys are resourcePath, resourceType and comment. The values of the map are values associated with the keys. Special characters must be escaped where required.

Parameters

None

Request Body

[
  {
    "resourcePath": "string",
    "resourceType": "string",
    "comment": "string"
  }
]

Example to create a new comment on a published resource

curl -X POST -u admin:admin "https://localhost:9502/rest/v2/comments" -H "Content-Type:application/json" -d '[{"resourcePath":"/localhost_9400/services/databases/ds/foo", "resourceType":"TABLE", "comment":"Hello World!"}]'

Example to create comments for multiple published resources

curl -X POST -u admin:admin "https://localhost:9502/rest/v2/comments" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/foo/bar/orders\", \"resourceType\":\"TABLE\", \"comment\":\"alpha\"},{\"resourcePath\":\"/localhost_9400/services/databases/foo/bar/employees\", \"resourceType\":\"TABLE\", \"comment\":\"beta\"}]"

Example to create comments for multiple published resources as ldap user

curl -X POST -u user@ldapDomain:password "https://localhost:9502/rest/v2/comments" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/foo/bar/orders\", \"resourceType\":\"TABLE\", \"comment\":\"alpha\"},{\"resourcePath\":\"/localhost_9400/services/databases/foo/bar/employees\", \"resourceType\":\"TABLE\", \"comment\":\"beta\"}]"

PUT /comments

This API is used to update comments. The provided JSON should be a map whose keys are the comment IDs for which comment needs to be updated. The corresponding values of the map should contain the updated comments. Special characters must be escaped where required.

Parameters

None

Request Body

{
  "additionalProp1": "string",
  "additionalProp2": "string",
  "additionalProp3": "string"
}

Example to update comment on a specific comment ID

curl -X PUT -u admin:admin "https://localhost:9502/rest/v2/comments" -H "Content-Type:application/json" -d "{\"1001\":\"changed comment\"}"

Example to update comment on a specific comment ID as ldap user

curl -X PUT -u user@ldapDomain:password "https://localhost:9502/rest/v2/comments" -H "Content-Type:application/json" -d "{\"1001\":\"changed comment\"}"

Example to update comment on a specific comment ID with X-HTTP-Method-Override

curl -X POST -u admin:admin "https://localhost:9502/rest/v2/comments" -H "X-HTTP-Method-Override:PUT" -H "Content-Type:application/json" -d "{\"1001\":\"changed comment\"}"

DELETE /comments

This API is used to delete comments. The provided JSON should be a list of comment IDs that are to be deleted.Special characters must be escaped where required.

Parameters

None

Request Body

[
  “string”
]

Example to delete comments

curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/comments" -H "Content-Type:application/json" -d "[1001]"

Example to delete comments as ldap user

curl -X DELETE -u user@ldapDomain:password "https://localhost:9502/rest/v2/comments" -H "Content-Type:application/json" -d "[1001]"

Example to delete comments with X-HTTP-Method-Override

curl -X POST -u admin:admin "https://localhost:9502/rest/v2/comments" -H "X-HTTP-Method-Override:DELETE" -H "Content-Type:application/json" -d "[1001]"

GET /comments/resource/{resourceId}

This API is used to fetch comments for a resource.

Parameters

Name

Description

Parameter Type

Data Type

resourceId

The resource identifier

path

integer

Example to retrieve comments for a resource

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/comments/resource/4567"

Example to retrieve comments for a resource as ldap user

curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/comments/resource/4567"

Equivalent system query

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/data/query" -H "query:select * from ALL_COMMENTS where RESOURCE_ID = 4567" -H "standardSQL:true" -H "system:true"

Example to retrieve count of comments for a resource.

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/comments/resource/4567?count"

GET /comments/{commentId}

This API is used to fetch a specific comment.

Parameters

Name

Description

Parameter Type

Data Type

commentId

The comment id

path

integer

Example to retrieve a comment

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/comments/1234"

Example to retrieve a comment as ldap user

curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/comments/1234"

 

Equivalent system query

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/data/query" -H "query:select * from ALL_COMMENTS where COMMENT_ID = 1234" -H "standardSQL:true" -H "system:true"