Stream.getSettings
From Social ID Developers
(Difference between revisions)
Ramon.maciel (Talk | contribs) (Created page with "== Description == API to get basic information about the stream. == Usage == stream.getSettings(handler) == Parameters == {| ! align="left" width="200px" | handler | wi...") |
Ramon.maciel (Talk | contribs) (→Response Data) |
||
(3 intermediate revisions by one user not shown) | |||
Line 30: | Line 30: | ||
{| | {| | ||
− | ! align="left" width="200px" | | + | ! align="left" width="200px" | group_id |
− | + | ||
− | + | ||
− | + | ||
| Comments & Reviews group id. | | Comments & Reviews group id. | ||
|- | |- | ||
− | ! align="left" width="200px" | | + | ! align="left" width="200px" | stream_id |
| Comments & Reviews stream public id. | | Comments & Reviews stream public id. | ||
|- | |- | ||
Line 69: | Line 66: | ||
data = { | data = { | ||
− | + | group_id: 1, | |
− | + | stream_id: "productReviews123", | |
− | + | ||
approved_posts_count: 35, | approved_posts_count: 35, | ||
approved_rating_sum: 105, | approved_rating_sum: 105, |
Latest revision as of 17:37, 7 June 2016
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:
group_id | Comments & Reviews group id. |
---|---|
stream_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 = { 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) }