Fetch list comments
Fetch list comments
This API may require setup from support before use. Please contact [email protected] to enable this in your store.
swat.fetchListComments
Fetches the Comments of a List with the given lid
Definition
swat.fetchListComments(options, onSuccess, onError)
Example
Here's an example of how you can use this API to fetch Comments of a specific List :
// Define the opts
let options = {
// List Id
lid: "list-id"
// limit: 8 // Optional Limit on number of comments to return
// sincets: timeinmilliseconds // Optional The timestamp from when returned comments should begin
// continuation: continuationtoken // Optional Continuation token passed back in the response
};
// Define success callback
let onSuccess = function(commentsObj) {
// Executed when list comments are successfully fetched
console.log("Successfully fetch List Comments", commentsObj);
}
// Define error callback
let onError = function(error) {
// Error is an xhrObject
console.log("Error while fetching List Comments", error);
}
swat.fetchListComments(options, onSuccess, onError);
API Parameters
Argument | Type | Description |
---|---|---|
options | object | options is a simple object containing config required for fetching List Comments |
onSuccess | function | Called when the List Comments are successfully fetched. |
onError | function | Called when there is an error while fetching the List Comments. |
Success Response
The success response is a Map containing continuation token and List Comments
{
"continuation": null,
"results": [
{
"cid": "comment-id",
"userinfo": {
"em": "email-id",
"fname": "first name",
"lname": "last name"
},
"txt": "My third comment is here",
"lid": "list-id",
"cts": 145555555511
}
]
}
Other References
options
Argument | Type | Required | Description | |
---|---|---|---|---|
options.lid | string | Yes | Unique id of the List to fetch Comments for | |
options.limit | number | optional | Number of Comments to fetch. Defaults to 100 | |
options.continuation | string | optional | Continuation token to paginate with the initial limit, returned in the response. Null when limit is not hit | |
options.sincets | number | optional | Timestamp in milliseconds to fetch comments since |
List Comments
Fields in List Comment Response
{
"cid": "System generated comment id",
"lid": "List id for the comment",
"txt": "Comment text",
"via": "set as 'email' if comment received via email",
"cby": "Created by email address",
"uby": "Updated by email address",
"cts": "Created at in milliseconds",
"userinfo": {} // userinfo for the comment adder
}
Argument | Type | Required | Description |
---|---|---|---|
cid | string | Yes | Comment id - system generated guid for the comment |
lid | string | Yes | List id - system generated guid for the list |
via | string | optional | Set as email if comment was received via email, else undefined |
txt | string | Yes | Comment content |
cprops | object | optional | Map of custom fields |
cts | number | Yes | Created time at in milliseconds |
cby | string | Yes | Email address of the user who added the commentDefaults to 1. Quantity included for the action |
userinfo | object | Yes | User info of the comment adder |
userinfo.em | string | Yes | Email address of the adder |
userinfo.fname | string | Yes | First name of the adder |
userinfo.lname | string | Yes | Last name of the adder |
Updated over 1 year ago