Add a comment to a list
Add comments to list.
This API may require setup from support before use. Please contact [email protected] to enable this in your store.
swat.addComment
Adds a Comment to a List
Comment APIs are supported only for logged in shoppers. Contact [email protected] to enable this feature on your storefront
Definition
swat.addComment(options, onSuccess, onError)
Example
Here's an example of how you can use this API to add Comment to a List :
// Define the opts
let options = {
listcomments: [{
"txt": "This List was used by ",
"lid": "list-id"
}]
}
// Define success callback
let onSuccess = function(response) {
// Executed when a comment is successfully added
console.log("Successfully added Comments to List", response);
}
// Define error callback
let onError = function(error) {
// Error is an xhrObject
console.log("Error while adding Comments to List", error);
}
swat.addComment(options, onSuccess, onError);
API Parameters
Argument | Type | Description |
---|---|---|
options | object | An object with a List Comment Input array |
listcomments | array | An array of List Comment Input |
onSuccess | function | Called when the List Comments are successfully added to the List. |
onError | function | Called when there is an error while fetching the List Comments to the List. |
Success Response
{
"listcomments": [
{
"cid": "comment-id",
"txt": "Some new comments",
"lid": "list-id",
"cts": 145555555511
}
],
"listitemcomments": []
}
Other References
List Comment Input
Object containing params required for creating new list comment
let comments = {
"lid": "list id",
"txt": "Comment text",
"cprops": {} // optional param
};
Argument | Type | Required | Description |
---|---|---|---|
lid | string | Yes | Unique id of the List to add Comment |
txt | string | Yes | Comment content |
cprops | object | optional | Map of custom fields |
Updated over 1 year ago