Publishes a user action to the newsfeed of all the connected providers.

 

Publishes a user action to the newsfeed of all the connected providers.

To learn more about publishing feed items, please read the Advanced Sharing page.

 

Note: This API should not be used on mobile apps unless you want to allow users to post to multiple networks at once.

 

 

Supporting Providers

This operation is currently supported by the following providers: Facebook, TwitterLinkedInVKontakte, Renren and Sina Weibo.

Note: Before your application can publish to Facebook, the user must grant your application an extended permission. Make sure you have checked the "Enable publishing user actions" check box in the Site Setup > Permissions page on Gigya's website. During the social login process, the user will be presented with a dialog in which the user can authorize your application to publish to his Facebook profile. Read more in the Facebook Setting - Permissions guide.

 

Possible Responses and the "Unsupported Provider" Error

When publishUserAction is called, the Gigya server tries to publish the user action to every provider to which the user is connected that is also listed in the 'enabledProviders' parameter. If the server succeeds in publishing to at least one of these providers, it considers the operation successful. An error is returned only if the server cannot publish to any of these providers.

In other words, if you call publishUserAction and specify an unsupported provider in 'enabledProviders', the call might still succeed if the user has other valid connected providers -- or it may fail for other reasons, e.g. an expired session on a supported provider.

The server returns an 'unsupported provider' error only if the user is connected to that unsupported provider and has no other valid connections.

 

 

Parameters

RequiredNameTypeDescription
userActionUserAction JSONThe user action to publish. The UserAction represented as a JSON string. See below the UserAction JSON representation.
Notes:
  • The UserAction JSON is equivalent to the UserAction object in the Web SDK. See further usage details there. Please remove empty values from the JSON.
  • A shared URL must match the approved URLs (domains) for the specified API key, otherwise the share will not work. 
  • When Twitter is the provider, only the Title and Link Back are posted.
actionAttributesJSON objectIn Gamification your users receive points for actions they perform on your site, in this case publishing a user action grants the user points. Action Attributes may be used to annotate actions with additional information, such as the section of the web site that generated the action. If you set here the actionAttributes, each time a user publishes a user action, the action also receives an attribute, for example "tv-show":"glee", which can mean that the action was performed on the "Glee" page of the site. 
cidstring
disabledProvidersstring 'facebook', 'twitter', 'linkedin', 'vkontakte', 'renren', 'sina'.
enabledProvidersstring 'facebook', 'twitter', 'linkedin', 'vkontakte', 'renren', 'sina'.
shortURLsstring
tagsstringA comma separated list of tags that are used to identify the share operation.
UserActionUserAction JSONIt is possible to specify different content to publish for each social network. For this purpose, the method supports a set of parameters with the same name format: (i.e. facebook, twitter, etc.) followed by "UserAction". For example: twitterUserAction - specifies the content to be used specifically when publishing to Twitter.
Each of these parameters accepts a UserAction JSON (same format as the userAction parameter. Each of these optional parameters if specified will override the userAction parameter when posting to that provider. In other words, the userAction parameter (see above) specifies the default content to be used for all social networks and UserAction specifies the content to be used for the specific network.
userLocationJSON ObjectThe location to which this user action refers. Assigning a location to a user action is currently supported by Twitter only. The value of this parameter should be a JSON object containing the following fields:
  • longitude - the longitude of the location. The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive.
  • latitude - the latitude of the location. The valid ranges for latitude is -90.0 to +90.0 (North is positive) inclusive.
  • placeID - a unique identifier of a place to which this status update refers.
    Note: you may receive a list of place identifiers using the socialize.getPlaces method.
See also socialize.checkin.

 

UserAction JSON Representation

{
    "userMessage":"Text entered by the user", 
    "title":"Link text displayed to user",  
      // actual link
    "linkBack":"http://google.com",  
    "subtitle":"This title appears below the link"
    "description":"Description of the link displayed below the subtitle",
      // additional options following the standard provider links below the post    
      //"actionLinks":[{"title":"text displayed","href":"http://wiki.gigya.com"},{"title":"text displayed2","href":"http://livejournal.com"}],   
    "mediaItems":
        [    
         // Note: add only ONE type of media items - images/flash/video/mps
         // images:
         {"src":"http://www.f2h.co.il/logo.jpg", "href":"http://www.f2h.co.il","type":"image"},
         {"src":"http://teo.esuper.ro/wp-content/images/cute_cat01.jpg","href":"http://teo.esuper.ro/","type":"image"},
         // video 
         {"src":"http://www.f2h.co.il/logo.avi","width":"100","height":"100",
         "previewImageURL":"http://www.f2h.co.il/logo.jpg","previewImageWidth":"200",
         "previewImageHeight":"90","type":"flash"} ,
         // mp3
         {"src":"http://denis.com/Around_The_World.mp3","title":"Around The World","artist":"Max Raabe","album":"Greatest Hits","type":"mp3"}
        ]
}

 

FieldTypeDescription
providerPostIDsJSON
Object
A list of social networks' post ID. The JSON object contains fields which are names of social networks. The optional field names are: 'facebook', 'twitter' and 'linkedin'. The value of each field is the post unique ID, as returned by the corresponding social network (see JSON example below). 
providerErrorCodesJSON
Array
An array of JSON objects representing the social network's post error codes. Each object has the following fields:
  • provider - the social network provider (string).
  • errorCode - the error code. Code '0' indicates success, any other number indicates failure.
  • errorMessage - a short textual description of an error, associated with the errorCode, for logging purposes.
  • errorDetails - This field will appear only in case of an error and will contain exception info, if available.

 

{
        "statusCode": 200,
        "errorCode": 0,
        "statusReason": "OK",
        "callId": "a40b878f32ba41a68db8a66000d23c8a",
        "time": "2015-03-22T11:42:25.943Z",
        "providerPostIDs": {
            "facebook": "696437547_10152162258982548"
        },
        "providerErrorCodes": [{
            "provider": "facebook",
            "errorCode": 0,
            "errorMessage": "OK"},
        {
            "provider": "twitter",
            "errorCode": 403024,
            "errorMessage": "Provider limit reached",
            "errorDetails": "Limit reached: Status is a duplicate."}]
}

 

<script>
$(document).ready(function() {
lssdk.tableFixer();
});
</script>