Fluent Commerce Logo
Docs
Sign In
Essential knowledge

Author:

Kirill Gaiduk

Changed on:

6 Dec 2024

Overview

The

Query retrieves Comments based on various filter criteria.


Prerequisites

  • `COMMENT_VIEW`
    Permission is required for retrieving Comments

Key points

  • Use the
    `comments`
    Query to retrieve existing Comments
  • Manage the Comment Permissions at the Account or Retailer level
  • Apply the "Retailer-specific Comment Permission Check" validation logic with the
    `fc.graphql.comment.access`
    Setting (
    `retailer`
    value)

Inputs

The Input arguments for retrieving Comments:

Argument

Type

Description

Notes

`entityType`

[String!]

Type of the Entity

For example:

  • `ORDER`
  • `FULFILMENT`
  • `ORDER_ITEM`
  • `PRODUCT_CATALOGUE`

`entityId`

[ID]

Id of the Entity


`entityRef`

[String]

Reference of the Entity


`text`

[String!]

Comment text


`createdOn`

DateRange

Date range for Comments creation


`updatedOn`

DateRange

Date range for Comments last update


`first`

Int

Returns the first n elements from the list


`last`

Int

Returns the last n elements from the list


`before`

String

Returns the elements in the list that come before the specified global Id

This is a cursor (the value is used for pagination)

`after`

String

Returns the elements in the list that come after the specified global Id

This is a cursor (the value is used for pagination)

Validation

Comment Permissions could be managed at the Account or Retailer level, which is controlled via the

Setting

The

`retailer`
Setting value enables the Retailer-specific access management, so the validation logic is applied to verify that your User has the correct rights to execute the
`comments`
Query - "Retailer-specific Comment Permission Check":

  • Comments are searched by the given Input Arguments
  • A Comment Entity
    `retailerId`
    field stores a Retailer of the associated Entity
  • For all the found Comments, the Comment
    `retailerId`
    is compared to the querying User
    `retailerId`
    (defined with the User Role Context Id)
  • The list of the retrieved Comments contains:
    • The Comments for which the mentioned (User and Comment)
      `retailerId`
      -s matches
    • The Comments with empty
      `retailerId`


Response

The response consists of Edges and Nodes representing the Comments:

Field

Type

Description

Notes

`id`

ID!

Id of the Comment


`entityType`

String!

Type of the Entity

For example:

  • `ORDER`
  • `FULFILMENT`
  • `ORDER_ITEM`
  • `PRODUCT_CATALOGUE`

`entityId`

ID

Id of the Entity


`entityRef`

String

Reference of the Entity


`text`

String!

Comment text


`createdOn`

DateTime

Time of the Comment creation


`updatedOn`

DateTime

Time of the Comment last update


`user`

User

The author of the Comment

  • Filled in upon the Comment creation
  • Updated upon the Comment update

Sample Payload

1query comments($createdOn: DateRange) {
2    comments(createdOn: $createdOn) {
3        edges {
4            node {
5                id
6                entityId
7                entityRef
8                entityType
9                text
10                createdOn
11                updatedOn
12            }
13            cursor
14        }
15    }
16}

Language: graphqlschema

Name: Sample comments Query

Description:

Getting the Comments created within the specified date range.

API Endpoint:

`POST: {{fluentApiHost}}/graphql`
.

1{
2    "createdOn": {
3        "from": "2024-11-16T00:32:28.935Z",
4        "to": "2024-11-16T23:40:28.935Z"
5    }
6}

Language: graphqlschema

Name: Sample GraphQL Variables for the comments Query

Description:

Getting the Comments created within the specified date range.

Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.

Fluent Logo