Add a comment to a product
Add a comment to product
swat.addComment
Adds a Comment to a product
Definition
swat.addComment(options, onSuccess, onError)
Example
Here's an example of how you can use this API to add Comment to a List Item :
// Define the opts
let options = {
listitemcomments: [
{
"txt":"Some item comment",
"empi":123,
"epi":111,
"lid":"list-id"
}
]
}
// Define success callback
let onSuccess = function(commentsObj) {
// Executed when comments are successfully added
console.log("Successfully added Comments to List Item", commentsObj);
}
// Define error callback
let onError = function(error) {
// Error is an xhrObject
console.log("Error while adding Comments to List Item", error);
}
swat.addComment(options, onSuccess, onError);
API Parameters
Argument | Type | Description |
---|---|---|
options | object | An options object with a List Item Comment Input array |
listitemcomments | array | An array of List Item Comment Input |
onSuccess | function | Called when the List Comments are successfully added to the List Item. |
onError | function | Called when there is an error while fetching the List Comments to the List Item. |
Success Response
{
"listcomments": [],
"listitemcomments": [
{
"cid": "comment-id",
"txt": "Some new comments",
"lid": "list-id",
"empi": 123,
"epi": 111,
"cts": 145555555511
}
]
}
Other References
List Item Comment Input
An object containing params required for creating new list item comment
let listItemCommentDef = {
"lid": "list id",
"empi": "Product master id",
"epi": "Product variant id",
"txt": "Comment text",
"cprops": {} // optional param
};
Argument | Type | Required | Description |
---|---|---|---|
lid | string | Yes | Unique id of the List to add Comment |
empi | number/string | Yes | Product master id of the List Item to add Comment |
epi | number/string | Yes | Product Variant id of the List Item to add Comment |
txt | string | Yes | Comment content |
cprops | object | optional | Map of custom fields |
Updated over 1 year ago