Fluent Commerce Logo
Docs
Sign In
Essential knowledge

Author:

Kirill Gaiduk

Changed on:

9 Dec 2024

Overview

The

Mutation allows for the updating of an existing Comment object.


Prerequisites

Specific Permissions are required for updating Comments:

  • `COMMENT_UPDATE`
  • `COMMENT_VIEW`

Key points

  • Use the
    `updateComment`
    Mutation to update an existing Comment
  • 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 fields for updating a Comment are defined with the

:

Field

Type

Description

Notes

`id`

ID!

Id of the Comment


`text`

String!

Comment text

Max character limit: 200

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
`updateComment`
Mutation - "Retailer-specific Comment Permission Check":

  • A target Comment is found by its Id (input)
  • A Comment Entity
    `retailerId`
    field stores a Retailer of the associated Entity
  • The Comment
    `retailerId`
    is compared to the querying User
    `retailerId`
    (defined with the User Role Context Id)
  • The Comment is updated upon the mentioned (User and Comment)
    `retailerId`
    's match


Response

The response consists of the details of the Comment:

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

1mutation updateComment ($input: UpdateCommentInput) {
2    updateComment (input: $input) {
3        id
4        entityType
5        entityRef
6        entityId
7        text
8        createdOn
9        updatedOn
10    }
11}

Language: graphqlschema

Name: Sample updateComment Mutation

Description:

Updating the Comment.

API Endpoint:

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

1{
2    "input": {
3        "id": "26963",
4        "text": "Sample Comment"
5    }
6}

Language: graphqlschema

Name: Sample GraphQL Variables for the updateComment Mutation

Description:

Updating the Comment with a specified Id.

1{
2    "data": {
3        "updateComment": {
4            "id": "26963",
5            "entityType": "ORDER",
6            "entityRef": null,
7            "entityId": "123",
8            "text": "Sample Comment",
9            "createdOn": "2024-12-09T09:15:57.396Z",
10            "updatedOn": "2024-12-09T09:22:57.791Z"
11        }
12    }
13}

Language: graphqlschema

Name: updateComment Mutation Response Example

Description:

Updating the Comment with a specified Id.

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