Gigya Job Openings

comments.getStreamInfo JS

Skip to end of metadata
Go to start of metadata

Description

 

Returns meta information of a specified commenting stream.
 

Note: This method is also supported in our REST API. If you wish to execute this method from your server, please refer to

REST API > comments.getStreamInfo.

 

Syntax

 

 

Parameters

The following table lists the available parameters:

RequiredNameTypeDescription
categoryIDstringThe identifier of the comments category to which the requested stream belongs.
streamIDstringThe unique ID of the stream that you would like to retrieve.
callbackfunction
A reference to a callback function. Gigya calls the specified function along with the results of the API method when the API method completes.
The callback function should be defined with the following signature: functionName(Response).
The "Response Object Data Members" table below provides specification of the data that is passed to the callback function.
contextobject
A developer-created object that is passed back unchanged to the application as one of the fields in the response object.
includeLastCommentBooleanThis parameter specifies whether to include the most recent comment in the stream. The default value of this parameter is "false". If this parameter is set to "true", the response of this method includes a lastComment field in the streamInfo object (see the Response Data table and Response Example below).
includeRatingDetailsBoolean

Indicates whether to return the ratingDetails object in the response. ratingDetails is an array of all dimensions and "_overall". For example:

ratingDetails: {
   "_overall" : {
      ratings: [0,5,3,6,9],
      avg: 3.82
   }
   "dimension1": {
      ratings: [1,4,2,1,0],
      avg: 2.37
   }
}

The ratings array represents the number of users who gave a specific rating, where the position in the array represents the given rating. So in the above example, 0 users gave a rating of 1 star, 5 users gave a rating of 2 stars, 3 users gave a rating of 3 stars etc. The average of the ratings is also returned.

streamIDsarray or string

A comma delimited list of stream IDs or an array of stream IDs, i.e. "['stream1','stream2']". When this parameter exists, it overrides the streamID parameter.

This parameter supports up to 100 stream IDs.

 

Response Object Data Members

FieldTypeDescription
errorCode integer The result code of the operation. Code '0' indicates success, any other number indicates failure. For a complete list of error codes, see the Response Codes and Errors table.
errorMessage string A short textual description of an error associated with the errorCode for logging purposes.
callId string Unique identifier of the transaction, for debugging purposes.
context object The context object passed by the application as a parameter to the API method, or null if no context object has been passed.
streamInfoStream info objectA JSON object containing meta information of the requested commenting stream. When multiple streamIDs are requested, the response streamInfo is an array of Stream info objects
streamTagsarrayAn array of tags that are associated with the stream.

 

Code Sample

function printResponse(response) {  
    if ( response.errorCode == 0 ) {             
        alert('Stream title: ' + response.streamInfo.<font>streamTitle</font><font> + </font>',  RSS URL: ' + response.streamInfo.<font>rssURL</font>);
    } else {
        alert('Error :' + response.errorMessage);
    }
}

var params = {
    categoryID: "123456",
    streamID: "foo1",
    callback:printResponse
};

gigya.comments.getStreamInfo(params); 

Notes:

  • This sample is not meant to be fully functional code. For brevity's sake, only the code required for demonstrating the API call itself is presented.
  • To run the code on your own domain, add your Gigya API key to the gigya.js URL. A Gigya API key can be obtained on the Site Dashboard page on Gigya's website. Please make sure that the domain from which you are loading the page is the same domain name that you used for generating the API key.
  • In some cases it is necessary to connect/login the user to a provider ? prior to calling the API method. You can learn more in the Social Login guide.