Browse comments
To fetch a list of all the comments posted on a Resource:
GET /comments/resource/<resourceId>.json?
api-version=v2
Request parameters
The endpoint accept the following parameters:
Param | Description | Required | Type |
---|---|---|---|
contain | Dictates the fields to be included in the search result | No | Array |
contain[creator] | Whether to include the User Id of the user who created the comment. | No | Boolean |
contain[modifier] | Whether to include the User Id of the user who modified the comment last. | No | Boolean |
Possible responses
Code | Description |
---|---|
200 | OK Request went through. The response payload will contain a list of matching comments. |
403 | Authentication Failure The user making the request is not authenticated. |
Examples
Request with filters
A request to fetch all comments posted on a Resource identified by id ecf0ed85-3bfc-5f45-b11d-74e9a86aa313 and that includes information about who created and modified will look like this:
GET /comments/resource/ecf0ed85-3bfc-5f45-b11d-74e9a86aa313.json
&contain[creator]=1
&contain[modifier]=1
Success response
A successful response will have an array of json objects. Something like this example below
{
"header": {
"id": "f9a8c7b1-ccf4-434b-aa7c-0e0926aff8ae",
"status": "success",
"servertime": 1554984913,
"action": "69692f38-cbbc-53c7-a44d-68164b57a091",
"message": "The operation was successful.",
"url": "\/comments\/resource\/8e3874ae-4b40-590b-968a-418f704b9d9a.json",
"code": 200
},
"body": [
{
"id": "7e740d3d-f6dc-4172-a6ed-ab629a823f85",
"parent_id": null,
"foreign_key": "8e3874ae-4b40-590b-968a-418f704b9d9a",
"foreign_model": "Resource",
"content": "This is a test comment",
"created": "2019-04-09T06:43:18+00:00",
"modified": "2019-04-09T06:43:18+00:00",
"created_by": "f848277c-5398-58f8-a82a-72397af2d450",
"modified_by": "f848277c-5398-58f8-a82a-72397af2d450",
"user_id": "f848277c-5398-58f8-a82a-72397af2d450",
"children": []
},
{
"id": "da213c84-3d61-596e-882b-f870c26bd0f5",
"parent_id": null,
"foreign_key": "8e3874ae-4b40-590b-968a-418f704b9d9a",
"foreign_model": "Resource",
"content": "this is a short comment",
"created": "2012-11-25T13:39:25+00:00",
"modified": "2012-11-25T13:39:25+00:00",
"created_by": "904bcd9f-ff51-5cfd-9de8-d2c876ade498",
"modified_by": "904bcd9f-ff51-5cfd-9de8-d2c876ade498",
"user_id": "904bcd9f-ff51-5cfd-9de8-d2c876ade498",
"children": [
{
"id": "1dd295f0-4d4e-51b3-b0ca-b0a9763b560c",
"parent_id": "da213c84-3d61-596e-882b-f870c26bd0f5",
"foreign_key": "8e3874ae-4b40-590b-968a-418f704b9d9a",
"foreign_model": "Resource",
"content": "this is a reply to the short comment",
"created": "2012-11-25T13:39:26+00:00",
"modified": "2012-11-25T13:39:26+00:00",
"created_by": "904bcd9f-ff51-5cfd-9de8-d2c876ade498",
"modified_by": "904bcd9f-ff51-5cfd-9de8-d2c876ade498",
"user_id": "904bcd9f-ff51-5cfd-9de8-d2c876ade498",
"children": []
}
]
}
]
}
Last updated
This article was last updated on April 23rd, 2019.You can also find the latest OpenAPI 2.0 specifications directly on the dedicated repository.
OpenAPI Specs repository