Returns information about friends of the current user. This method supports getting either basic or extended information for all or some of the user's friends. The method returns the user's friends from all the connected providers that support friends feature.
Note that retrieving friends' data should be requested explicitly by checking the appropriate checkbox in the console's permissions section.
In some cases, you can use the getRawData API to retrieve data directly from the provider for information that is not natively provided by Gigya.
Note: This method is also supported in our REST API. If you wish to execute this method from your server, please refer toREST API > socialize.getFriendsInfo.
The following providers currently support this operation:
The Gigya service supports a mechanism to verify the authenticity of the getFriendsInfo process.
If the global configuration object's signIDs field is set to 'true', Gigya "signs" each friend with a cryptographic signature to prevent fraud.
As part of the response object, your site will receive the list of friends in the getFriendsInfo's callback function (please refer to the Response object Data Members table below). Each Friend object has a cryptographic signature (friendshipSignature data member) provided by Gigya.
We highly recommend verifying the authenticity of the signature to prove that it has indeed originated from Gigya rather than somewhere else.
To learn more about this subject, please refer to the Validate Friendship Signatures section in the Security page of the Developer's Guide.
The following table lists the available parameters:
|||detailLevel||string||This field indicates whether to get basic or extended information about each friend. See the Friend object page for details on which fields are included for each detail level.|
Allowed values are:
|||friends||Collection||A collection of Friend objects representing a list of friends (as returned by the Friends Selector Plugin). When this parameter is provided, the function returns information only about the friends in the list.|
This is useful if you want to get information about friends who were selected using the Friend Selector plugin.
|||siteUsersOnly||Boolean||If the parameter is set to 'true' then only the friends who are also site users are returned. The default value of this parameter is 'false'.|
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.
A comma-delimited list of provider names to include in the method execution. This parameter gives the possibility to apply this method only to a subset of providers of your choice. If you do not set this parameter, by default all the providers are enabled (i.e., the method applies to all connected providers).'facebook', googleplus, 'twitter', 'yahoo', 'microsoft', 'line', 'linkedin', 'qq', 'renren', 'sina' , vkontakte , wechat (Note: messenger has been replaced by microsoft, however, for backward compatibility, either can be used), foursquare', 'renren'', 'vkontakte', 'mixi', 'yahoojapan', 'xing'.
For example, if you would like the method to apply only to Twitter, define: enabledProviders: "twitter".
Valid provider names include:
A comma-delimited list of provider names to exclude in the method execution. This parameter gives the possibility to specify providers to which you do not want this method to apply. If you do not set this parameter, by default, no provider is disabled (i.e., the method applies to all connected providers).'facebook', googleplus, 'twitter', 'yahoo', 'microsoft', 'line', 'linkedin', 'qq', 'renren', 'sina' , vkontakte , wechat (Note: messenger has been replaced by microsoft, however, for backward compatibility, either can be used), foursquare', 'renren', 'vkontakte', 'mixi', 'yahoojapan', 'xing'.
For example, if you would like the method to apply to all providers except Twitter, define: disabledProviders: "twitter".
Valid provider names include:
A string of maximum 100 characters length. The CID sets categories for transactions that can be used later for filtering reports generated by Gigya in the "Context ID" combo box. The CID allows you to associate the report information with your own internal data. For example, to identify a specific widget or page on your site/application. You should not define more than 100 different context IDs.
A developer-created object that is passed back unchanged to the application as one of the fields in the response object.
Response Object Data Members
|friends||Collection||A collection of Friend objects, corresponding to the list of friends of the current user on all the social networks to which the user is connected.|
If either the 'friends' or 'UIDs' input parameters are provided in the function call, only the specified friends are retrieved.
|UIDs||string||A comma-separated list of UIDs of friends of the current user.|
Note: The UIDs list is equivalent to the 'friends' collection field.
In the Get Friends Information page you will find a complete working example that uses the socialize.getFriendsInfo method. You may view the code, run it and view the outcome.