Gigya Job Openings

comments.getRelatedUsers JS

Skip to end of metadata
Go to start of metadata


This method receives information about the current comment being written and a prefix of the user name to search, and returns a list of suggested users for auto-complete.


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.getRelatedUsers.






The following table lists the available parameters:

categoryIDstringThe identifier of the current comments category.
streamIDstringThe identifier of the current comments stream.
parentCommentIDstringThe identifier of the parent of the comment that is being written. If the current comment is not a reply, the value is null.
limitintegerThe maximum number of users to retrieve. The default value is 10. The maximum possible value to set is 25.
usernamePrefixstringA prefix of the user name to search.


Response Object Data Members

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.
usersArray of objectsAn array containing the suggested users for auto-complete. Each object includes the following fields:
  • uid: The unique identifier of the user (will not be returned for guest users)
  • name: The name of the user
  • photoURL: The URL of the user's profile photo
  • provider: The provider to which the user belongs.

Code Sample

function printResponse(response) { 
    if ( response.errorCode == 0 ) {            
        if ( null!=response.users&& response.users.length>0) {       
            var msg = "The first 3 users are:\n\n";  
            for (var index in response.users) {    
                   msg += "Name " + index + ": " + response.users[0].name;
        else {
            alert('No users were returned');
    } else {
        alert('Error :' + response.errorMessage);

var params = {
    categoryID: "12345",
    streamID: "abc",
    parentCommentID: null