Reports Comments API
General notes
Content
Reports collection:
Single report:
Reports collection
Report Comments index
This method needs logged-in user or known ClientUserAgent
Request
| Index behaviour | Definition |
|---|---|
| Paginated by default | No |
| Sorting | id, comment, report_id, user_id, client_user_agent_id, created_at |
| Filters | id:int, report_id:int, comment:string, client_user_agent_id:int, user_id:int, created_at:date |
GET /api/v0/reports/1/comments HTTP/1.1
Content-Type: application/json
Responses
200 OK
GET /api/v0/reports/1/comments HTTP/1.1
Content-Type: application/json
{
"items": [
{
"id": 6,
"comment": "Komentář jako uživatel",
"report_id": 4,
"user_id": 2,
"client_user_agent_id": null,
"created_at": "2023-06-07T08:38:30.000000Z"
},
{
"id": 7,
"comment": "Komentář jako klient",
"report_id": 4,
"user_id": null,
"client_user_agent_id": 5,
"created_at": "2023-06-07T08:46:50.000000Z"
}
]
}
401 Unauthorized
GET /api/v0/reports/1/comments HTTP/1.1
Content-Type: application/json
Create Report Comment
This method needs logged-in user or known ClientUserAgent
Request
POST /api/v0/reports/1/comments HTTP/1.1
Content-Type: application/json
{
"comment": "Komentář jako uživatel"
}
Responses
200 OK
POST /api/v0/reports/1/comments HTTP/1.1
Content-Type: application/json
{
"id": 10,
"comment": "tESTOvací KomeNT jako USER11",
"report_id": 2,
"user_id": 1,
"client_user_agent_id": null,
"created_at": "2023-06-07T09:39:43.000000Z"
}
401 UNAUTHORIZED
POST /api/v0/reports/1/comments HTTP/1.1
Content-Type: application/json
Status-Code: 401
Single Report Comment
Report Comment detail
GET /api/v0/reports/{report_id}/comments/{comment_id}
This method needs logged-in user or known ClientUserAgent
Get ReportComment detail.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
comment | string | User/Client comment | Required. Must be string. |
Request
GET /api/v0/reports/1/comments/6 HTTP/1.1
Content-Type: application/json
Response
200 OK
GET /api/v0/reports/1/comments/6 HTTP/1.1
Content-Type: application/json
{
"id": 6,
"comment": "Komentář jako uživatel",
"report_id": 4,
"user_id": 2,
"client_user_agent_id": null,
"created_at": "2023-06-07T08:38:30.000000Z"
}
404 NOT FOUND
Report was not found.
GET /api/v0/reports/130/comment/1 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}
Report Comment was not found.
GET /api/v0/reports/1/comments/999 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}
Update Report Comment
PUT/PATCH /api/v0/reports/{report_id}/comments/{comment_id}
This method needs permission
updateor client must be an author of the original comment.
Method for updating ReportComment data.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
comment | string | User/Client comment | Must be string. |
Request
PUT /api/v0/reports/1/comments/10 HTTP/1.1
Content-Type: application/json
{
"comment": "Oprava komentáře"
}
Response
200 OK
ReportComment successfully updated.
PUT /api/reports/1/comments/10 HTTP/1.1
Content-Type: application/json
{
"id": 10,
"comment": "Oprava komentáře",
"report_id": 1,
"user_id": 1,
"client_user_agent_id": null,
"created_at": "2023-06-07T09:39:43.000000Z"
}
401 UNAUTHORIZED
PUT /api/v0/reports/2/comments/1 HTTP/1.1
Content-Type: application/json
Status-Code: 401
404 NOT FOUND
Report was not found.
PUT /api/v0/reports/2/comments/1 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"comment": "Oprava komentáře",
}
ReportComment was not found.
PUT /api/v0/reports/2/comments/1 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"comment": "Oprava komentáře",
}
422 UNPROCESSABLE ENTITY
Validation error occurred. Comment must be a type string.
PUT /api/v0/reports/1/comments/10 HTTP/1.1
Content-Type: application/json
{
"comment": 1,
}
Delete Report Comment
DELETE /api/v0/reports/{report_id}/comments/{comment_id}
This method needs permission
deleteonreportComment.
Method for deleting ReportComment.
Request
DELETE /api/v0/reports/1/comments/1 HTTP/1.1
Content-Type: application/json
Response
204 NO CONTENT
ReportComment successfully deleted.
404 NOT FOUND
Report was not found.
DELETE /api/v0/reports/1 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}