Stream.getSettings
From Social ID Developers
Revision as of 17:55, 6 June 2016 by Ramon.maciel (Talk | contribs)
Contents |
Description
API to get basic information about the stream.
Usage
stream.getSettings(handler)
Parameters
handler | optional | callback function to handle the API response. |
---|
API Response
data | Javascript object containing the current settings for this stream. | status | The API response status. Can be success, if the stream has already been set up and its configuration was successfully retrieved, or not_found, if the stream doesn't exist. |
---|
Response Data
The data object properties are:
id | Comments & Reviews stream id (internal use only). |
---|---|
comments_group_id | Comments & Reviews group id. |
external_id | Comments & Reviews stream public id. |
approved_posts_count | Total number of approved posts. |
approved_rating_sum | Total rating of approved posts. |
created_at | Date of stream creation (likely to be the first post submission time). |
updated_at | Date of last stream update (likely to be the last post submission time). |
Example
Get basic information about the stream settings:
var stream = socialid.comments.getStream(1, "productReviews123"); var handler = function(response) { if (response.status == "success") { alert("Average rating " + (response.data.approved_rating_sum / response.data.approved_posts_count)); } else { alert("Could not get info from the stream."); } } stream.getSettings(handler);
Example of "data" object:
data = { id: 632, group_id: 1, stream_id: "productReviews123", approved_posts_count: 35, approved_rating_sum: 105, created_at: Fri Jun 01 2016 16:31:36 GMT-0300 (BRT), updated_at: Fri Jun 03 2016 02:45:09 GMT-0300 (BRT) }