Get Comment by Id
Author:
Kirill Gaiduk
Changed on:
8 Dec 2024
Overview
The `commentById`
Prerequisites
- Permission is required for retrieving a Comment
`COMMENT_VIEW`
Key points
- Use the Query to retrieve an existing Comment
`commentById`
- Manage the Comment Permissions at the Account or Retailer level
- Apply the "Retailer-specific Comment Permission Check" validation logic with the Setting (
`fc.graphql.comment.access`
value)`retailer`
Inputs
The Input arguments for retrieving a single Comment:
Argument | Type | Description |
| ID! | Id of the Comment |
Validation
Comment Permissions could be managed at the Account or Retailer level, which is controlled via the `fc.graphql.comment.access`
The
`retailer`
`commentById`
- A target Comment is found by its Id (input)
- A Comment Entity field stores a Retailer of the associated Entity
`retailerId`
- The Comment is compared to the querying User
`retailerId`
(defined with the User Role Context Id)`retailerId`
- The Comment is retrieved upon the mentioned (User and Comment) 's match
`retailerId`
Response
The response consists of the details of the Comment:
Field | Type | Description | Notes |
| ID! | Id of the Comment | |
| String! | Type of the Entity | For example:
|
| ID | Id of the Entity | |
| String | Reference of the Entity | |
| String! | Comment text | |
| DateTime | Time of the Comment creation | |
| DateTime | Time of the Comment last update | |
| User | The author of the Comment |
|
Sample Payload
1query commentById ($id: ID!) {
2 commentById (id: $id) {
3 id
4 entityType
5 entityId
6 entityRef
7 text
8 createdOn
9 updatedOn
10 user {
11 username
12 id
13 ref
14 primaryEmail
15 firstName
16 lastName
17 timezone
18 }
19 }
20}
Language: graphqlschema
Name: Sample commentById Query
Description:
Getting the Comment.
API Endpoint:
`POST: {{fluentApiHost}}/graphql`
1{
2 "id": 123
3}
Language: graphqlschema
Name: Sample GraphQL Variables for the commentById Query
Description:
Getting the Comment with a specified Id.