Social connect with Facebook, Twitter, LinkedIn etc to post, update, invite, fetch, refer etc.
import com.shephertz.app42.paas.sdk.android.App42API; import com.shephertz.app42.paas.sdk.android.App42Response; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.social.Social; import com.shephertz.app42.paas.sdk.android.social.SocialService;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.social;#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"import com.shephertz.app42.paas.sdk.java.App42API; import com.shephertz.app42.paas.sdk.java.App42Response; import com.shephertz.app42.paas.sdk.java.App42Exception; import com.shephertz.app42.paas.sdk.java.App42BadParameterException; import com.shephertz.app42.paas.sdk.java.App42NotFoundException; import com.shephertz.app42.paas.sdk.java.social.Social; import com.shephertz.app42.paas.sdk.java.social.SocialService;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.social;<script type="text/javascript" src="App42-all-x.x.x.min.js">local App42API = require("App42-Lua-API.App42API")#include "App42API.h"using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.social;include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php'; include_once '../SocialService.php'; include_once '../App42Log.php';#include "App42API.h"require 'App42_Ruby_API'import com.shephertz.app42.paas.sdk.as3.App42API; import com.shephertz.app42.paas.sdk.as3.App42Response; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42BadParameterException; import com.shephertz.app42.paas.sdk.as3.App42NotFoundException; import com.shephertz.app42.paas.sdk.as3.social.Social; import com.shephertz.app42.paas.sdk.as3.social.SocialService;Not Availableimport com.shephertz.app42.paas.sdk.jme.App42API; import com.shephertz.app42.paas.sdk.jme.App42Response; import com.shephertz.app42.paas.sdk.jme.App42Exception; import com.shephertz.app42.paas.sdk.jme.App42BadParameterException; import com.shephertz.app42.paas.sdk.jme.App42NotFoundException; import com.shephertz.app42.paas.sdk.jme.social.Social; import com.shephertz.app42.paas.sdk.jme.social.SocialService;
In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.
Required Parameters
apiKey - The Application key given when the application was created.
secretKey - The secret key corresponding to the application key given when the application was created.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42.initialize("API_KEY","SECRET_KEY");App42API:initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42API::initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");api = App42::ServiceAPI.new("API_KEY","SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");Coming SoonApp42API.initialize("API_KEY","SECRET_KEY");
After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of Social Service, buildSocialService() method needs to be called.
SocialService socialService = App42API.buildSocialService();SocialService socialService = App42API.BuildSocialService();SocialService *socialService = [App42API buildSocialService];let socialService = App42API.buildSocialService as! SocialServiceSocialService socialService = App42API.buildSocialService();SocialService socialService = App42API.BuildSocialService();var socialService = new App42Social();local socialService = App42API:buildSocialService()SocialService *socialService = App42API::BuildSocialService();SocialService socialService = App42API.BuildSocialService();$socialService = App42API::buildSocialService();SocialService *socialService = App42API::BuildSocialService();social_service = api.build_social_service()var socialService:SocialService = App42API.buildSocialService();Not AvailableSocialService socialService = App42API.buildSocialService();
Link the user Facebook access credentials to their account.
Required Parameters
userName - Name of the user whose Facebook account is to be linked.
accessToken - Facebook access token that has been received after authorization.
String userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.linkUserFacebookAccount(userName, accessToken, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("userName is " + social.getUserName()); System.out.println("facebookAccessToken is " + social.getFacebookAccessToken()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.LinkUserFacebookAccount(userName, accessToken, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("fb Access Token is" + social.GetFacebookAccessToken()); String jsonResponse = social.ToString(); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; NSString *accessToken = @"<Enter Facebook Access Token>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService linkUserFacebookAccount:userName accessToken:accessToken completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"userName is %@",social.userName); NSLog(@"FacebookAccessToken is %@",social.facebookAccessToken); NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let accessToken = "<Enter Facebook Access Token>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.linkUserFacebookAccount(userName,accessToken:accessToken,completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("userName is %@",social.userName) NSLog("FacebookAccessToken is %@",social.facebookAccessToken) NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserFacebookAccount(userName, accessToken); System.out.println("userName is " + social.getUserName()); System.out.println("facebookAccessToken is " + social.getFacebookAccessToken()); String jsonResponse = social.toString();String userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); App42Log.SetDebug(true); //Print output in your editor console socialService.LinkUserFacebookAccount(userName, accessToken, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); App42Log.Console("fb Access Token is" + social.GetFacebookAccessToken()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", accessToken = "<Enter Facebook Access Token>", social ; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.linkUserFacebookAccount(userName, accessToken,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("userName is " + social.userName) console.log("fb Access Token is " + social.facebookAccessToken) }, error: function(error) { } });local userName = "Nick" local accessToken = "<Enter Facebook Access Token>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:linkUserFacebookAccount(userName, accessToken, App42CallBack) function App42CallBack:onSuccess(object) print("userName is " ..object:getUserName()); print("facebookAccessToken is "..object:getFacebookAccessToken()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* accessToken = "<Enter Facebook Access Token>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserFacebookAccount(userName, accessToken, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nFBAccessToken=%s",app42SocialResponse->social.getFacebookAccessToken().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.LinkUserFacebookAccount(userName, accessToken); Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("fb Access Token is" + social.GetFacebookAccessToken()); String jsonResponse = social.ToString();$userName = "Nick"; $accessToken = "<Enter Facebook Access Token>"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->linkUserFacebookAccount($userName, $accessToken); print_r("userName is" . $social->getUserName()); print_r("fb Access Token is" . $social->getFacebookAccessToken()); $jsonResponse = $social->toString();const char* userName = "Nick"; const char* accessToken = "<Enter Facebook Access Token>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserFacebookAccount(userName, accessToken, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nFBAccessToken=%s",app42SocialResponse->social.getFacebookAccessToken().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }user_name = "Nick"; facebook_access_token = "<Enter Facebook Access Token>"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") social_service = api.build_social_service() social = social_service.link_user_facebook_account(user_name, facebook_access_token); puts "userName is #{social.user_name}"; puts "facebookAccessToken is #{social.facebook_access_token}"; json_response = social.to_s();var userName:String = "Nick"; var accessToken:String = "<Enter Facebook Access Token>"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.linkUserFacebookAccount(userName,accessToken, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("userName is " + social.getUserName()); trace("fb Access Token is " + social.getFacebookAccessToken()); } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserFacebookAccount(userName, accessToken); System.out.println("userName is " + social.getUserName()); System.out.println("fb Access Token is " + social.getFacebookAccessToken()); String jsonResponse = social.toString();
Link the user Facebook access credentials to their account.
Required Parameters
userName - Name of the user whose Facebook account is to be linked.
accessToken - Facebook access token that has been received after authorization.
appId - Facebook App Id.
appSecret - Facebook App Secret.
String userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; String appId = "FACEBOOK APP ID"; String appSecret = "FACEBOOK APP SECRET"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.linkUserFacebookAccount(userName, accessToken, appId, appSecret, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println(social); System.out.println("userName is " + social.getUserName()); System.out.println("facebookAccessToken is " + social.getFacebookAccessToken()); System.out.println("facebookAppId is " + social.getFacebookAppId()); System.out.println("facebookAppSecret is " + social.getFacebookAppSecret()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; String appId = "FACEBOOK APP ID"; String appSecret = "FACEBOOK APP SECRET"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.LinkUserFacebookAccount(userName, accessToken,appId,appSecret, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("fb Access Token is" + social.GetFacebookAccessToken()); String jsonResponse = social.ToString(); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; NSString *accessToken = @"<Enter Facebook Access Token>"; NSString *appId = @"FACEBOOK APP ID"; NSString *appSecret = @"FACEBOOK APP SECRET"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService linkUserFacebookAccount:userName appId:appId appSecret:appSecret accessToken:accessToken completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"userName is %@",social.userName); NSLog(@"FacebookAccessToken is %@",social.facebookAccessToken); NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let accessToken = "<Enter Facebook Access Token>" let appId = "FACEBOOK APP ID" let appSecret = "FACEBOOK APP SECRET" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.linkUserFacebookAccount(userName, appId:appId, appSecret:appSecret, accessToken:accessToken,completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("userName is %@",social.userName) NSLog("FacebookAccessToken is %@",social.facebookAccessToken) NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; String appId = "FACEBOOK APP ID"; String appSecret = "FACEBOOK APP SECRET"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserFacebookAccount(userName, accessToken,appId,appSecret); System.out.println(social); System.out.println("userName is " + social.getUserName()); System.out.println("facebookAccessToken is " + social.getFacebookAccessToken()); System.out.println("facebookAppId is " + social.getFacebookAppId()); System.out.println("facebookAppSecret is " + social.getFacebookAppSecret()); String jsonResponse = social.toString();String userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; String appId = "FACEBOOK APP ID"; String appSecret = "FACEBOOK APP SECRET"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); App42Log.SetDebug(true); //Print output in your editor console socialService.LinkUserFacebookAccount(userName, accessToken, appId, appSecret, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); App42Log.Console("fb Access Token is" + social.GetFacebookAccessToken()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", accessToken = "<Enter Facebook Access Token>", appId = "FACEBOOK APP ID", appSecret = "FACEBOOK APP SECRET", social ; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.linkUserFacebookAccountWithCredentials(userName, accessToken,appId,appSecret,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("userName is " + social.userName) console.log("fb Access Token is " + social.facebookAccessToken) }, error: function(error) { } });Not Availableconst char* userName = "Nick"; const char* accessToken = "<Enter Facebook Access Token>"; const char* appId = "FACEBOOK APP ID"; const char* appSecret = "FACEBOOK APP SECRET"; App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserFacebookAccount(userName, accessToken, appId, appSecret, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nFBAccessToken=%s",app42SocialResponse->social.getFacebookAccessToken().c_str()); printf("\nFBAppId=%s",app42SocialResponse->social.getFacebookAppId().c_str()); printf("\nFBAppSecret=%s",app42SocialResponse->social.getFacebookAppSecret().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; String appId = "FACEBOOK APP ID"; String appSecret = "FACEBOOK APP SECRET"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.LinkUserFacebookAccount(userName, accessToken,appId,appSecret); Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("fb Access Token is" + social.GetFacebookAccessToken()); String jsonResponse = social.ToString();$userName = "Nick"; $accessToken = "<Enter Facebook Access Token>" ; $appId = "FACEBOOK APP ID"; $appSecret = "FACEBOOK APP SECRET"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->linkUserFacebookAccount($userName, $accessToken,$appId,$appSecret); print_r("userName is :" . $social->getUserName()); print_r("FacebookAppId is :" . $social->getFacebookAppId()); print_r("FacebookAppSecret is:" . $social->getFacebookAppSecret()); print_r("FacebookAccessToken is:" . $social->getFacebookAccessToken()); $jsonResponse = $social->toString();const char* userName = "Nick"; const char* accessToken = "<Enter Facebook Access Token>"; const char* appId = "FACEBOOK APP ID"; const char* appSecret = "FACEBOOK APP SECRET"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserFacebookAccount(userName, accessToken, appId, appSecret, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nFBAccessToken=%s",app42SocialResponse->social.getFacebookAccessToken().c_str()); printf("\nFBAppId=%s",app42SocialResponse->social.getFacebookAppId().c_str()); printf("\nFBAppSecret=%s",app42SocialResponse->social.getFacebookAppSecret().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }user_name = "Nick"; facebook_access_token = "<Enter Facebook Access Token>"; facebook_app_id = "FACEBOOK APP ID"; facebook_app_secret = "FACEBOOK APP SECRET"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") social_service = api.build_social_service() social = social_service.link_user_facebook_account_with_token(user_name, facebook_access_token, facebook_app_id, facebook_app_secret); puts "userName is #{social.user_name}"; puts "facebookAccessToken is #{social.facebook_access_token}"; json_response = social.to_s();Not AvailableNot AvailableString userName = "Nick"; String accessToken = "<Enter Facebook Access Token>"; String appId = "FACEBOOK APP ID"; String appSecret = "FACEBOOK APP SECRET"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserFacebookAccount(userName, accessToken,appId,appSecret); System.out.println("userName is " + social.getUserName()); System.out.println("fb Access Token is " + social.getFacebookAccessToken()); String jsonResponse = social.toString();
Update the Facebook status of the specified user.
Required Parameters
userName - Name of the user for whom the status needs to be updated.
status - Status that has to be updated.
String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.updateFacebookStatus(userName, status, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("userName is " + social.getUserName()); System.out.println("status is " + social.getStatus()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.UpdateFacebookStatus(userName, status, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("status is" + social.GetStatus()); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; NSString *status = @"Nick is using the App42 API"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService updateFacebookStatus:userName status:status completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"userName is %@",social.userName); NSLog(@"status is %@",social.status); NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let status = "Nick is using the App42 API" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.updateFacebookStatus(userName, status:status,completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("userName is %@",social.userName) NSLog("status is %@",social.status) NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.updateFacebookStatus(userName, status); System.out.println("userName is " + social.getUserName()); System.out.println("status is " + social.getStatus()); String jsonResponse = social.toString();String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); App42Log.SetDebug(true); //Print output in your editor console socialService.UpdateFacebookStatus(userName, status, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); App42Log.Console("status is" + social.GetStatus()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", status = "Nick is using the App42 API", social ; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.updateFacebookStatus(userName, status,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("userName is " + social.userName) console.log("status is " + social.status) }, error: function(error) { } });local userName = "Nick" local status = "Nick is using the App42 API" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:updateFacebookStatus(userName, status,App42CallBack) function App42CallBack:onSuccess(object) print("userName is " ..object:getUserName()); print("status is " ..object:getStatus()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* status = "Nick is using the App42 API"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->UpdateFacebookStatus(userName, status, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nStatus=%s",app42SocialResponse->social.getStatus().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.UpdateFacebookStatus(userName, status); Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("status is" + social.GetStatus()); String jsonResponse = social.ToString();$userName = "Nick"; $status = "Nick is using the App42 API"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->updateFacebookStatus($userName, $status); Print_r("userName is" . $social->getUserName()); Print_r("status is" . $social->getStatus()); $jsonResponse = $social->toString();const char* userName = "Nick"; const char* status = "Nick is using the App42 API"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->UpdateFacebookStatus(userName, status, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nStatus=%s",app42SocialResponse->social.getStatus().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }user_name = "Nick"; status = "Nick is using the App42 API"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") social_service = api.build_social_service() social = social_service.update_facebook_status(user_name, status); puts "userName is #{social.user_name}"; json_response = social.to_s();var userName:String = "Nick"; var status:String = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.updateFacebookStatus(userName,status, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("userName is " + social.getUserName()); trace("status is " + social.getStatus()); } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.updateFacebookStatus(userName, status); System.out.println("userName is " + social.getUserName()); System.out.println("fb Access Token is " + social.getStatus()); String jsonResponse = social.toString();
This function returns a list of Facebook friends of the specified user by accessing their Facebook account. That user first has to link their app account to their Facebook profile.
Required Parameters
userName - Name of the user whose Facebook friends has to be retrieved.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.getFacebookFriendsFromLinkUser(userName, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("userName is " + social.getUserName()); for(int i =0; i < social.getFriendList().size();i++) { System.out.println("Installed is : " + social.getFriendList().get(i).getInstalled()); System.out.println("Id is : " + social.getFriendList().get(i).getId()); System.out.println("Picture is :" + social.getFriendList().get(i).getPicture()); System.out.println("Name is : " + social.getFriendList().get(i).getName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.GetFacebookFriendsFromLinkUser(userName, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("userName is" + social.GetUserName()); for(int i =0; i < social.GetFriendList().Count;i++) { Console.WriteLine("Installed is : " + social.GetFriendList()[i].GetInstalled()); Console.WriteLine("Id is : " + social.GetFriendList()[i].GetId()); Console.WriteLine("Name is : " + social.GetFriendList()[i].GetName()); } } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService getFacebookFriendsFromLinkUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"UserName = %@",social.userName); for (Friends *friend in social.friendsList) { NSLog(@"Name=%@",friend.name); NSLog(@"Picture=%@",friend.picture); NSLog(@"Id=%@",friend.friendId); NSLog(@"Installed=%d",friend.installed); } NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.getFacebookFriendsFromLinkUser(userName,completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("UserName = %@",social.userName); for friend in social.friendsList { NSLog("Name=%@",friend.name) NSLog("Picture=%@",friend.picture) NSLog("Id=%@",friend.friendId) NSLog("Installed=%d",friend.installed) } NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.getFacebookFriendsFromLinkUser(userName); System.out.println("userName is " + social.getUserName()); for(int i =0; i < social.getFriendList().size();i++) { System.out.println("Installed is : " + social.getFriendList().get(i).getInstalled()); System.out.println("Id is : " + social.getFriendList().get(i).getId()); System.out.println("Picture is :" + social.getFriendList().get(i).getPicture()); System.out.println("Name is : " + social.getFriendList().get(i).getName()); }String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.GetFacebookFriendsFromLinkUser(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); for(int i =0; i < social.GetFriendList().Count;i++) { App42Log.Console("Installed is : " + social.GetFriendList()[i].GetInstalled()); App42Log.Console("Id is : " + social.GetFriendList()[i].GetId()); App42Log.Console("Name is : " + social.GetFriendList()[i].GetName()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", social; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.getFacebookFriendsFromLinkUser(userName,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("userName is " + social.userName) }, error: function(error) { } });local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:getFacebookFriendsFromLinkUser(userName,App42CallBack) function App42CallBack:onSuccess(object) print("userName is " ..object:getUserName()); for m=1,table.getn(object:getFriendList()) do print(object:getFriendList()[m]:getInstalled()) print("Id is : " ..object:getFriendList()[m]:getId()); print("Picture is :" ..object:getFriendList()[m]:getPicture()); print("Name is : " ..object:getFriendList()[m]:getName()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->GetFacebookFriendsFromLinkUser(userName, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); /** * Getting friends */ vector<App42Friend> friends = app42SocialResponse->friendsList; for(std::vector<App42Friend>::iterator it = friends.begin(); it != friends.end(); ++it) { printf("\nFriendId=%s",it->getFriendId().c_str()); printf("\nName=%s\n",it->getName().c_str()); printf("\nPictureUrl=%s\n",it->getPicture().c_str()); printf("\nInstalled=%d\n",it->getInstalled()); } } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.GetFacebookFriendsFromLinkUser(userName); Console.WriteLine("userName is" + social.GetUserName()); for(int i =0; i < social.GetFriendList().Count;i++) { Console.WriteLine("Installed is : " + social.GetFriendList()[i].GetInstalled()); Console.WriteLine("Id is : " + social.GetFriendList()[i].GetId()); Console.WriteLine("Name is : " + social.GetFriendList()[i].GetName()); }$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->getFacebookFriendsFromLinkUser($userName); print_r("userName is" . $social->getUserName()); $friendList = $social->getFriendslist(); foreach ($friendList as $friends) { print_r("Friend Name : ".$friends->getName()); print_r("Id : ".$friends->getId()); print_r("Picture is : ".$friends->getPicture()); print_r("Installed is : " . $friends->getInstalled()); } $jsonResponse = $social->toString();const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->GetFacebookFriendsFromLinkUser(userName, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); /** * Getting friends */ vector<App42Friend> friends = app42SocialResponse->friendsList; for(std::vector<App42Friend>::iterator it = friends.begin(); it != friends.end(); ++it) { printf("\nFriendId=%s",it->getFriendId().c_str()); printf("\nName=%s\n",it->getName().c_str()); printf("\nPictureUrl=%s\n",it->getPicture().c_str()); printf("\nInstalled=%d\n",it->getInstalled()); } } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }Not Availablevar userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.getFacebookFriendsFromLinkUser(userName, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("userName is " + social.getUserName()); if(social.getFriendList().length > 0){ for(var i:int=0;i<social.getFriendList().length;i++){ trace("Name is : " + Friends(social.getFriendList()[i]).getName()); trace("Id is " + Friends(social.getFriendList()[i]).getId()); trace("Picture is " + Friends(social.getFriendList()[i]).getPicture()); trace("Installed is " + Friends(social.getFriendList()[i]).getInstalled()); } } } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.getFacebookFriendsFromLinkUser(userName); System.out.println("userName is " + social.getUserName()); Vector friendList = social.getFriendList(); for(int i=0;i < friendList.size();i++) { Social.Friends friend = (Social.Friends)friendList.elementAt(i); System.out.println("Installed is : " + friend.getInstalled()); System.out.println("Id is : " + friend.getId()); System.out.println("Name is : " + friend.getName()); }
This function returns a list of Facebook friends of the specified user using a given authorization token.
Required Parameters
accessToken - Facebook Access Token that has been received after authorization.
String accessToken = "<Enter Facebook Access Token>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.getFacebookFriendsFromAccessToken(accessToken, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("accessToken is " + social.getFacebookAccessToken()); for(int i =0; i < social.getFriendList().size();i++) { System.out.println("Installed is : " + social.getFriendList().get(i).getInstalled()); System.out.println("Id is : " + social.getFriendList().get(i).getId()); System.out.println("Picture is :" + social.getFriendList().get(i).getPicture()); System.out.println("Name is : " + social.getFriendList().get(i).getName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String accessToken = "<Enter Facebook Access Token>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.GetFacebookFriendsFromAccessToken(accessToken, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("accessToken is" + social.GetFacebookAccessToken()); Console.WriteLine("userName is" + social.GetUserName()); for(int i =0; i < social.GetFriendList().Count;i++) { Console.WriteLine("Installed is : " + social.GetFriendList()[i].GetInstalled()); Console.WriteLine("Id is : " + social.GetFriendList()[i].GetId()); Console.WriteLine("Name is : " + social.GetFriendList()[i].GetName()); } } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *accessToken = @"<Enter Facebook Access Token>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService getFacebookFriendsFromAccessToken:accessToken completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; for (Friends *friend in social.friendsList) { NSLog(@"Name=%@",friend.name); NSLog(@"Picture=%@",friend.picture); NSLog(@"Id=%@",friend.friendId); NSLog(@"Installed=%d",friend.installed); } NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let accessToken = "<Enter Facebook Access Token>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.getFacebookFriendsFromAccessToken(accessToken,completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social for friend in social.friendsList { NSLog("Name=%@",friend.name) NSLog("Picture=%@",friend.picture) NSLog("Id=%@",friend.friendId) NSLog("Installed=%d",friend.installed) } NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String accessToken = "<Enter Facebook Access Token>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.getFacebookFriendsFromAccessToken(accessToken); System.out.println("accessToken is " + social.getFacebookAccessToken()); for(int i =0; i < social.getFriendList().size();i++) { System.out.println("Installed is : " + social.getFriendList().get(i).getInstalled()); System.out.println("Id is : " + social.getFriendList().get(i).getId()); System.out.println("Picture is :" + social.getFriendList().get(i).getPicture()); System.out.println("Name is : " + social.getFriendList().get(i).getName()); }String accessToken = "<Enter Facebook Access Token>"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.GetFacebookFriendsFromAccessToken(accessToken, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("accessToken is" + social.GetFacebookAccessToken()); for(int i =0; i < social.GetFriendList().Count;i++) { App42Log.Console("Installed is : " + social.GetFriendList()[i].GetInstalled()); App42Log.Console("Id is : " + social.GetFriendList()[i].GetId()); App42Log.Console("Name is : " + social.GetFriendList()[i].GetName()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var accessToken = "<Enter Facebook Access Token>", social; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.getFacebookFriendsFromAccessToken(accessToken,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("accessToken is " + social.facebookAccessToken); var friends = social.friends; if (friends instanceof Array) { for (var i = 0; i < friends.length; i++) { console.log("Id : " + friends[i].id) console.log("Installed : " + friends[i].installed) console.log("Name : " + friends[i].name) console.log("Picture : " + friends[i].picture) } } else { console.log("Id : " + friends.id) console.log("Installed : " + friends.installed) console.log("Name : " + friends.name) console.log("Picture : " + friends.picture) } }, error: function (error) { } });local accessToken = "<Enter Facebook Access Token>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:getFacebookFriendsFromAccessToken(accessToken,App42CallBack) function App42CallBack:onSuccess(object) print("Access Token is " ..object:getFacebookAccessToken()); for m=1,table.getn(object:getFriendList()) do print(object:getFriendList()[m]:getInstalled()) print("Id is : " ..object:getFriendList()[m]:getId()); print("Picture is :" ..object:getFriendList()[m]:getPicture()); print("Name is : " ..object:getFriendList()[m]:getName()); end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* accessToken = "<Enter Facebook Access Token>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->GetFacebookFriendsFromAccessToken(accessToken, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nFBAccessToken=%s",app42SocialResponse->social.getFacebookAccessToken().c_str()); /** * Getting friends */ vector<App42Friend> friends = app42SocialResponse->friendsList; for(std::vector<App42Friend>::iterator it = friends.begin(); it != friends.end(); ++it) { printf("\nFriendId=%s",it->getFriendId().c_str()); printf("\nName=%s\n",it->getName().c_str()); printf("\nPictureUrl=%s\n",it->getPicture().c_str()); printf("\nInstalled=%d\n",it->getInstalled()); } } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String accessToken = "<Enter Facebook Access Token>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.GetFacebookFriendsFromAccessToken(accessToken); Console.WriteLine("accessToken is" + social.GetFacebookAccessToken()); for(int i =0; i < social.GetFriendList().Count;i++) { Console.WriteLine("Installed is : " + social.GetFriendList()[i].GetInstalled()); Console.WriteLine("Id is : " + social.GetFriendList()[i].GetId()); Console.WriteLine("Name is : " + social.GetFriendList()[i].GetName()); }$accessToken = "<Enter Facebook Access Token>"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->getFacebookFriendsFromAccessToken($accessToken); print_r("accessToken is" . $social->getFacebookAccessToken()); $friendList = $social->getFriendslist(); foreach ($friendList as $friends) { print_r("Friend Name : ".$friends->getName()); print_r("Id : ".$friends->getId()); print_r("Picture is : ".$friends->getPicture()); print_r("Installed is : " . $friends->getInstalled()); } $jsonResponse = $social->toString();const char* accessToken = "<Enter Facebook Access Token>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->GetFacebookFriendsFromAccessToken(accessToken, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nFBAccessToken=%s",app42SocialResponse->social.getFacebookAccessToken().c_str()); /** * Getting friends */ vector<App42Friend> friends = app42SocialResponse->friendsList; for(std::vector<App42Friend>::iterator it = friends.begin(); it != friends.end(); ++it) { printf("\nFriendId=%s",it->getFriendId().c_str()); printf("\nName=%s\n",it->getName().c_str()); printf("\nPictureUrl=%s\n",it->getPicture().c_str()); printf("\nInstalled=%d\n",it->getInstalled()); } } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }Not Availablevar accessToken:String = "<Enter Facebook Access Token>"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.getFacebookFriendsFromAccessToken(accessToken, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("accessToken is " + social.getFacebookAccessToken()); if(social.getFriendList().length > 0){ for(var i:int=0;i<social.getFriendList().length;i++){ trace("Name is : " + Friends(social.getFriendList()[i]).getName()); trace("Id is " + Friends(social.getFriendList()[i]).getId()); trace("Picture is " + Friends(social.getFriendList()[i]).getPicture()); trace("Installed is " + Friends(social.getFriendList()[i]).getInstalled()); } } } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString accessToken = "<Enter Facebook Access Token>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.getFacebookFriendsFromAccessToken(accessToken); System.out.println("accessToken is " + social.getFacebookAccessToken()); Vector friendList = social.getFriendList(); for(int i=0;i < friendList.size();i++) { Social.Friends friend = (Social.Friends)friendList.elementAt(i); System.out.println("Installed is : " + friend.getInstalled()); System.out.println("Id is : " + friend.getId()); System.out.println("Name is : " + friend.getName()); }
Link the user’s Twitter access credentials to their app account.
Required Parameters
userName - Name of the user whose Twitter account is to be linked.
accessToken - Twitter Access Token that has been received after authorization.
accessTokenSecret - Twitter Access Token Secret that has been received after authorization.
String userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.linkUserTwitterAccount(userName, accessToken, accessTokenSecret, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("userName is :" + social.getUserName()); System.out.println("TwitterAccessToken is : " + social.getTwitterAccessToken()); System.out.println("TwitterAccessTokenSecret is :" + social.getTwitterAccessTokenSecret()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.LinkUserTwitterAccount(userName, accessToken,accessTokenSecret, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("twitterAccessToken is" + social.GetTwitterAccessToken()); String jsonResponse = social.ToString(); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; NSString *accessToken = @"<Enter Twitter Access Token>"; NSString *accessTokenSecret = @"<Enter Twitter Access Token Secret>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService linkUserTwitterAccount:userName accessToken:accessToken accessTokenSecret:accessTokenSecret completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"UserName = %@",social.userName); NSLog(@"twitterAccessToken is %@",social.twitterAccessToken); NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let accessToken = "<Enter Twitter Access Token>" let accessTokenSecret = "<Enter Twitter Access Token Secret>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.linkUserTwitterAccount(userName, accessToken:accessToken, accessTokenSecret:accessTokenSecret, completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("UserName = %@",social.userName) NSLog("twitterAccessToken is %@",social.twitterAccessToken) NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserTwitterAccount(userName, accessToken,accessTokenSecret); System.out.println("userName is :" + social.getUserName()); System.out.println("TwitterAccessToken is : " + social.getTwitterAccessToken()); System.out.println("TwitterAccessTokenSecret is :" + social.getTwitterAccessTokenSecret()); String jsonResponse = social.toString();String userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.LinkUserTwitterAccount(userName, accessToken,accessTokenSecret, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); App42Log.Console("twitterAccessToken is" + social.GetTwitterAccessToken()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", accessToken = "<Enter Twitter Access Token>", accessTokenSecret = "<Enter Twitter Access Token Secret>", social ; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.linkUserTwitterAccount(userName, accessToken,accessTokenSecret,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("userName is " + social.userName) console.log("twitterAccessToken is " + social.twitterAccessToken) }, error: function(error) { } });local userName = "Nick" local accessToken = "<Enter Twitter Access Token>" local accessTokenSecret = "<Enter Twitter Access Token Secret>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:linkUserTwitterAccount(userName,accessToken, accessTokenSecret,App42CallBack) function App42CallBack:onSuccess(object) print("userName is :"..object:getUserName()); print("TwitterAccessToken is : " ..object:getTwitterAccessToken()); print("TwitterAccessTokenSecret is :" ..object:getTwitterAccessTokenSecret()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* twitterAccessToken = "<Enter Twitter Access Token>"; const char* twitterAccessTokenSecret = "<Enter Twitter Access Token Secret>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserTwitterAccount(userName, twitterAccessToken, twitterAccessTokenSecret, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nTwitterAccessToken=%s",app42SocialResponse->social.getTwitterAccessToken().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.LinkUserTwitterAccount(userName, accessToken,accessTokenSecret); Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("twitterAccessToken is" + social.GetTwitterAccessToken()); String jsonResponse = social.ToString();$userName = "Nick"; $accessToken = "<Enter Twitter Access Token>"; $accessTokenSecret = "<Enter Twitter Access Token Secret>"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->linkUserTwitterAccount($userName, $accessToken,$accessTokenSecret); Print_r("userName is" . $social->getUserName()); Print_r("twitterAccessToken is" . $social->getTwitterAccessToken()); $jsonResponse = $social->toString();const char* userName = "Nick"; const char* twitterAccessToken = "<Enter Twitter Access Token>"; const char* twitterAccessTokenSecret = "<Enter Twitter Access Token Secret>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserTwitterAccount(userName, twitterAccessToken, twitterAccessTokenSecret, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nTwitterAccessToken=%s",app42SocialResponse->social.getTwitterAccessToken().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }user_name = "Nick"; twitter_access_token = "<Enter Twitter Access Token>"; twitter_access_token_secret = "<Enter Twitter Access Token Secret>"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") social_service = api.build_social_service() social = socialService.link_user_twitter_account(user_name, twitter_access_token, twitter_access_token_secret); puts "userName is #{social.user_name}"; puts "twitterAccessToken is #{social.twitter_access_token}"; puts "twitterAccessTokenSecret is #{social.twitter_access_token_secret}"; json_response = social.to_s();var userName:String = "Nick"; var accessToken:String = "<Enter Twitter Access Token>"; var accessTokenSecret:String = "<Enter Twitter Access Token Secret>"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.linkUserTwitterAccount(userName,accessToken,accessTokenSecret, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("userName is " + social.getUserName()); trace("twitterAccessToken is " + social.getTwitterAccessToken()); } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserTwitterAccount(userName, accessToken,accessTokenSecret); System.out.println("userName is " + social.getUserName()); System.out.println("twitterAccessToken is " + social.getTwitterAccessToken()); String jsonResponse = social.toString();
Link the user’s Twitter access credentials to ther app account.
Required Parameters
userName - Name of the user whose Twitter account is to be linked.
accessToken - Twitter Access Token that has been received after authorization.
accessTokenSecret - Twitter Access Token Secret that has been received after authorization.
consumerKey - Twitter App Consumer Key.
consumerSecret - Twitter App Consumer Secret.
String userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; String consumerKey = "<Enter Twitter Consumer Key>"; String consumerSecret = "<Enter Twitter Consumer Secret>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.linkUserTwitterAccount(userName,accessToken,accessTokenSecret,twitterConsumerKey,consumerSecret,new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("userName is " + social.getUserName()); System.out.println("twitterAccessToken is :" + social.getTwitterAccessToken()); System.out.println("twitterAccessTokenSecret is :" + social.getTwitterAccessTokenSecret()); System.out.println("twitterConsumerKey is :" + social.getTwitterConsumerKey()); System.out.println("twitterConsumerSecret is :" + social.getTwitterConsumerSecret()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; String consumerKey = "<Enter Twitter Consumer Key>"; String consumerSecret = "<Enter Twitter Consumer Secret>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.LinkUserTwitterAccount(userName, accessToken,accessTokenSecret,consumerKey,consumerSecret, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("twitterAccessToken is" + social.GetTwitterAccessToken()); String jsonResponse = social.ToString(); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; NSString *accessToken = @"<Enter Twitter Access Token>"; NSString *accessTokenSecret = @"<Enter Twitter Access Token Secret>"; NSString *consumerKey = @"<Enter Twitter Consumer Key>"; NSString *consumerSecret = @"<Enter Twitter Consumer Secret>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService linkUserTwitterAccount:userName consumerKey:consumerKey consumerSecret:consumerSecret accessToken:accessToken accessTokenSecret:accessTokenSecret completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"UserName = %@",social.userName); NSLog(@"twitterAccessToken is %@",social.twitterAccessToken); NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let accessToken = "<Enter Twitter Access Token>" let accessTokenSecret = "<Enter Twitter Access Token Secret>" let consumerKey = "<Enter Twitter Consumer Key>" let consumerSecret = "<Enter Twitter Consumer Secret>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.linkUserTwitterAccount(userName, consumerKey:consumerKey, consumerSecret:consumerSecret, accessToken:accessToken, accessTokenSecret:accessTokenSecret, completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("UserName = %@",social.userName) NSLog("twitterAccessToken is %@",social.twitterAccessToken) NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; String consumerKey = "<Enter Twitter Consumer Key>"; String consumerSecret = "<Enter Twitter Consumer Secret>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserTwitterAccount(userName, accessToken,accessTokenSecret,consumerKey,consumerSecret); System.out.println("userName is " + social.getUserName()); System.out.println("twitterAccessToken is :" + social.getTwitterAccessToken()); System.out.println("twitterAccessTokenSecret is :" + social.getTwitterAccessTokenSecret()); System.out.println("twitterConsumerKey is :" + social.getTwitterConsumerKey()); System.out.println("twitterConsumerSecret is :" + social.getTwitterConsumerSecret()); String jsonResponse = social.toString();String userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; String consumerKey = "<Enter Twitter Consumer Key>"; String consumerSecret = "<Enter Twitter Consumer Secret>"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.LinkUserTwitterAccount(userName, accessToken, accessTokenSecret, consumerKey, consumerSecret, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); App42Log.Console("twitterAccessToken is" + social.GetTwitterAccessToken()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", accessToken = "<Enter Twitter Access Token>", accessTokenSecret = "<Enter Twitter Access Token Secret>", consumerKey = "<Enter Twitter Consumer Key>", consumerSecret = "<Enter Twitter Consumer Secret>", social ; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.linkUserTwitterAccountWithCredentials(userName, accessToken,accessTokenSecret,consumerKey,consumerSecret,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("userName is " + social.userName) console.log("twitterAccessToken is " + social.twitterAccessToken) }, error: function(error) { } });local userName = "Nick" local accessToken = "<Enter Twitter Access Token>" local accessTokenSecret = "<Enter Twitter Access Token Secret>" local consumerKey = "<Enter Twitter Consumer Key>" local consumerSecret = "<Enter Twitter Consumer Secret>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:linkUserLinkedInAccountWithCredentials(userName,accessToken, accessTokenSecret, consumerKey,consumerSecret ,App42CallBack) function App42CallBack:onSuccess(object) print("userName is " ..object:getUserName()); print("linkedinAccessToken is " ..object:getLinkedinAccessToken()); print("linkedinAccessTokenSecret is " ..object:getLinkedinAccessTokenSecret()); print("LinkedinApiKey" ..object:getLinkedinApiKey()); print("LinkedinSecretKey" ..object:getLinkedinSecretKey()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* twitterConsumerKey = "<Enter Twitter Consumer Key>"; const char* twitterConsumerSecret = "<Enter Twitter Consumer Secret>"; const char* twitterAccessToken = "<Enter Twitter Access Token>"; const char* twitterAccessTokenSecret = "<Enter Twitter Access Token Secret>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserTwitterAccount(userName, twitterConsumerKey, twitterConsumerSecret, twitterAccessToken, twitterAccessTokenSecret, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nTWAccessToken=%s",app42SocialResponse->social.getTwitterAccessToken().c_str()); printf("\nTWAccessTokenSecret=%s",app42SocialResponse->social.getTwitterAccessTokenSecret().c_str()); printf("\nTWConsumerKey=%s",app42SocialResponse->social.getTwitterConsumerKey().c_str()); printf("\nTWConsumerSecret=%s",app42SocialResponse->social.getTwitterConsumerSecret().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; String consumerKey = "<Enter Twitter Consumer Key>"; String consumerSecret = "<Enter Twitter Consumer Secret>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.LinkUserTwitterAccount(userName, accessToken,accessTokenSecret,consumerKey,consumerSecret); Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("twitterAccessToken is" + social.GetTwitterAccessToken()); String jsonResponse = social.ToString();$userName = "Nick"; $accessToken = "<Enter Twitter Access Token>"; $accessTokenSecret = "<Enter Twitter Access Token Secret>"; $consumerKey = "<Enter Twitter Consumer Key>"; $consumerSecret = "<Enter Twitter Consumer Secret>"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->linkUserTwitterAccount($userName, $accessToken,$accessTokenSecret,$consumerKey,$consumerSecret); Print_r("userName is" . $social->getUserName()); Print_r("twitterAccessToken is" . $social->getTwitterAccessToken()); $jsonResponse = $social->toString();const char* userName = "Nick"; const char* twitterConsumerKey = "<Enter Twitter Consumer Key>"; const char* twitterConsumerSecret = "<Enter Twitter Consumer Secret>"; const char* twitterAccessToken = "<Enter Twitter Access Token>"; const char* twitterAccessTokenSecret = "<Enter Twitter Access Token Secret>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserTwitterAccount(userName, twitterConsumerKey, twitterConsumerSecret, twitterAccessToken, twitterAccessTokenSecret, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nTWAccessToken=%s",app42SocialResponse->social.getTwitterAccessToken().c_str()); printf("\nTWAccessTokenSecret=%s",app42SocialResponse->social.getTwitterAccessTokenSecret().c_str()); printf("\nTWConsumerKey=%s",app42SocialResponse->social.getTwitterConsumerKey().c_str()); printf("\nTWConsumerSecret=%s",app42SocialResponse->social.getTwitterConsumerSecret().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }user_name = "Nick"; twitter_access_token = "<Enter Twitter Access Token>"; twitter_access__token_secret = "<Enter Twitter Access Token Secret>"; twitter_consumer_key = "<Enter Twitter Consumer Key>"; twitter_consumer_secret = "<Enter Twitter Consumer Secret>"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") social_service = api.build_social_service() social = social_service.link_user_twitter_account_with_token(user_name, twitter_access_token, twitter_access__token_secret, twitter_consumer_key, twitter_consumer_secret); puts "userName is #{social.user_name}"; puts "twitterAccessToken is #{social.twitter_access_token}"; puts "twitterAccessTokenSecret is #{social.twitter_access__token_secret}"; puts "twitterConsumerKey is #{social.twitter_consumer_key}"; puts "twitterConsumerSecret is #{social.twitter_consumer_secret}"; json_response = social.to_s();var userName:String = "Nick"; var accessToken:String = "<Enter Twitter Access Token>"; var accessTokenSecret:String = "<Enter Twitter Access Token Secret>"; var consumerKey:String = "<Enter Twitter Consumer Key>"; var consumerSecret:String = "<Enter Twitter Consumer Secret>"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.linkUserTwitterAccountWithCredentials(userName,accessToken,accessTokenSecret,consumerKey,consumerSecret, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("userName is " + social.getUserName()); trace("twitterAccessToken is " + social.getTwitterAccessToken()); } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString userName = "Nick"; String accessToken = "<Enter Twitter Access Token>"; String accessTokenSecret = "<Enter Twitter Access Token Secret>"; String consumerKey = "<Enter Twitter Consumer Key>"; String consumerSecret = "<Enter Twitter Consumer Secret>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserTwitterAccount(userName, accessToken,accessTokenSecret,consumerKey,consumerSecret); System.out.println("userName is " + social.getUserName()); System.out.println("twitterAccessToken is " + social.getTwitterAccessToken()); String jsonResponse = social.toString();
Update the Twitter status of the specified user.
Required Parameters
userName - Name of the user for whom the status needs to be updated.
status - Status that has to be updated.
String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.updateTwitterStatus(userName, status, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("userName is :" + social.getUserName()); System.out.println("Status is : " + social.getStatus()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.UpdateTwitterStatus(userName, status, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("status is" + social.GetStatus()); String jsonResponse = social.ToString(); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; NSString *status = @"Nick is using the App42 API"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService updateTwitterStatus:userName status:status completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"UserName = %@",social.userName); NSLog(@"status is %@",social.status); NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick"; let status = "Nick is using the App42 API" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.updateTwitterStatus(userName, status:status, completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("UserName = %@",social.userName) NSLog("status is %@",social.status) NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.updateTwitterStatus(userName, status); System.out.println("userName is :" + social.getUserName()); System.out.println("Status is : " + social.getStatus()); String jsonResponse = social.toString();String userName = "Nick"; String status = "Nick is using the App42 API"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.UpdateTwitterStatus(userName, status, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); App42Log.Console("status is" + social.GetStatus()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", status = "Nick is using the App42 API", social ; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.updateTwitterStatus(userName, status,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("userName is " + social.userName) console.log("status is " + social.status) }, error: function(error) { } });local userName = "Nick" local status = "Nick is using the App42 API" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:updateTwitterStatus(userName, status ,App42CallBack) function App42CallBack:onSuccess(object) print("userName is :"..object:getUserName()); print("Status is : "..object:getStatus()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* status = "Nick is using the App42 API"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->UpdateTwitterStatus(userName, status, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nStatus=%s",app42SocialResponse->social.getStatus().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.UpdateTwitterStatus(userName, status); Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("status is" + social.GetStatus()); String jsonResponse = social.ToString();$userName = "Nick"; $status = "Nick is using the App42 API"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->updateTwitterStatus($userName, $status); Print_r("userName is" . $social->getUserName()); Print_r("status is" . $social->getStatus()); $jsonResponse = $social->toString();const char* userName = "Nick"; const char* status = "Nick is using the App42 API"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->UpdateTwitterStatus(userName, status, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nStatus=%s",app42SocialResponse->social.getStatus().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }user_name = "Nick"; status = "Nick is using the App42 API"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") social_service = api.build_social_service() social = social_service.update_twitter_status(user_name, status); puts "userName is #{social.user_name}"; puts "status is #{social.status}"; puts "twitterConsumerKey is #{social.twitter_consumer_key}"; puts "twitterConsumerSecret is #{social.twitter_consumer_secret}"; puts "twitterAccessToken is #{social.twitter_access_token}"; puts "twitterAccessToken is #{social.twitter_access_token_secret}"; json_response = social.to_s();var userName:String = "Nick"; var status:String = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.updateTwitterStatus(userName,status, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("userName is " + social.getUserName()); trace("status is " + social.getStatus()); } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.updateTwitterStatus(userName, status); System.out.println("userName is " + social.getUserName()); System.out.println("fb Access Token is " + social.getStatus()); String jsonResponse = social.toString();
Link the user’s LinkedIn access credentials to their app account.
Required Parameters
userName - Name of the user whose LinkedIn account is to be linked.
accessToken - LinkedIn Access Token that has been received after authorization.
accessTokenSecret - LinkedIn Access Token Secret that has been received after authorization.
String userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.linkUserLinkedInAccount(userName, accessToken, accessTokenSecret, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("userName is " + social.getUserName()); System.out.println("linkedinAccessToken is " + social.getLinkedinAccessToken()); System.out.println("linkedinAccessTokenSecret is " + social.getLinkedinAccessTokenSecret()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.LinkUserLinkedInAccount(userName, accessToken,accessTokenSecret, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("linkedinAccessToken is" + social.GetLinkedinAccessToken()); String jsonResponse = social.ToString(); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; NSString *accessToken = @"<Enter LinkedIn Access Token>"; NSString *accessTokenSecret = @"<Enter LinkedIn Access Token Secret>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService linkUserLinkedInAccount:userName accessToken:accessToken accessTokenSecret:accessTokenSecret completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"userName is %@",social.userName); NSLog(@"linkedinAccessToken is %@",social.linkedinAccessToken); NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let accessToken = "<Enter LinkedIn Access Token>" let accessTokenSecret = "<Enter LinkedIn Access Token Secret>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.linkUserLinkedInAccount(userName, accessToken:accessToken, accessTokenSecret:accessTokenSecret, completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("userName is %@",social.userName) NSLog("linkedinAccessToken is %@",social.linkedinAccessToken) NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserLinkedInAccount(userName, accessToken,accessTokenSecret); System.out.println("userName is " + social.getUserName()); System.out.println("linkedinAccessToken is " + social.getLinkedinAccessToken()); System.out.println("linkedinAccessTokenSecret is " + social.getLinkedinAccessTokenSecret()); String jsonResponse = social.toString();String userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.LinkUserLinkedInAccount(userName, accessToken,accessTokenSecret, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); App42Log.Console("linkedinAccessToken is" + social.GetLinkedinAccessToken()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", accessToken = "<Enter LinkedIn Access Token>", accessTokenSecret = "<Enter LinkedIn Access Token Secret>", social ; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.linkUserLinkedInAccount(userName, accessToken,accessTokenSecret,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("userName is " + social.userName) console.log("linkedinAccessToken is " + social.linkedinAccessToken) }, error: function(error) { } });local userName = "Nick" local accessToken = "<Enter LinkedIn Access Token>" local accessTokenSecret = "<Enter LinkedIn Access Token Secret>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:linkUserLinkedInAccount(userName, accessToken, accessTokenSecret ,App42CallBack) function App42CallBack:onSuccess(object) print("userName is "..object:getUserName()); print("linkedinAccessToken is " ..object:getLinkedinAccessToken()); print("linkedinAccessTokenSecret is " ..object:getLinkedinAccessTokenSecret()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* linkedinAccessToken = "<Enter LinkedIn Access Token>"; const char* linkedinAccessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserLinkedInAccount(userName, linkedinAccessToken, linkedinAccessTokenSecret,app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nLinkedInAccessToken=%s",app42SocialResponse->social.getLinkedinAccessToken().c_str()); printf("\nLinkedInAccessTokenSecret=%s",app42SocialResponse->social.getLinkedinAccessTokenSecret().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.LinkUserLinkedInAccount(userName, accessToken,accessTokenSecret); Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("linkedinAccessToken is" + social.GetLinkedinAccessToken()); String jsonResponse = social.ToString();$userName = "Nick"; $accessToken = "<Enter LinkedIn Access Token>"; $accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->linkUserLinkedInAccount($userName, $accessToken,$accessTokenSecret); print_r("userName is" . $social->getUserName()); print_r("linkedinAccessToken is" . $social->getLinkedinAccessToken()); print_r("linkedinAccessTokenSecret is " . $social->getLinkedinAccessTokenSecret()); $jsonResponse = $social->toString();const char* userName = "Nick"; const char* linkedinAccessToken = "<Enter LinkedIn Access Token>"; const char* linkedinAccessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserLinkedInAccount(userName, linkedinAccessToken, linkedinAccessTokenSecret, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nLinkedInAccessToken=%s",app42SocialResponse->social.getLinkedinAccessToken().c_str()); printf("\nLinkedInAccessTokenSecret=%s",app42SocialResponse->social.getLinkedinAccessTokenSecret().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }user_name = "Nick"; access_token = "<Enter LinkedIn Access Token>"; access_token_secret = "<Enter LinkedIn Access Token Secret>"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") social_service = api.build_social_service() social = social_service.link_user_linkedIn_account(user_name, access_token, access_token_secret); puts "userName is #{social.user_name}"; puts "linkedinAccessToken is #{social.linkedin_access_token}"; puts "linkedinAccessTokenSecret is #{social.linkedin_access_token_secret}"; response = social.response(); json_response = social.to_s();var userName:String = "Nick"; var accessToken:String = "<Enter LinkedIn Access Token>"; var accessTokenSecret:String = "<Enter LinkedIn Access Token Secret>"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.linkUserLinkedInAccount(userName,accessToken,accessTokenSecret, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("userName is " + social.getUserName()); trace("linkedinAccessToken is " + social.getLinkedinAccessToken()); } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserLinkedInAccount(userName, accessToken,accessTokenSecret); System.out.println("userName is " + social.getUserName()); System.out.println("linkedinAccessToken is " + social.getLinkedinAccessToken()); String jsonResponse = social.toString();
Link the user’s LinkedIn access credentials to the their app account.
Required Parameters
userName - Name of the user whose LinkedIn account is to be linked.
accessToken - LinkedIn Access Token that has been received after authorization.
accessTokenSecret - LinkedIn Access Token Secret that has been received after authorization.
linkedInApiKey - LinkedIn App API Key.
linkedInSecretKey - LinkedIn App Secret Key.
String userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; String linkedInApiKey = "<Enter LinkedIn Api Key>"; String linkedInSecretKey = "<Enter LinkedIn Secret Key>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.linkUserLinkedInAccount(userName,accessToken,accessTokenSecret,linkedInApiKey,linkedInSecretKey,new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("userName is " + social.getUserName()); System.out.println("linkedinAccessToken is " + social.getLinkedinAccessToken()); System.out.println("linkedinAccessTokenSecret is " + social.getLinkedinAccessTokenSecret()); System.out.println("LinkedinApiKey" + social.getLinkedinApiKey()); System.out.println("LinkedinSecretKey" + social.getLinkedinSecretKey()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; String linkedInApiKey = "<Enter LinkedIn Api Key>"; String linkedInSecretKey = "<Enter LinkedIn Secret Key>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.LinkUserLinkedInAccount(userName, accessToken,accessTokenSecret,linkedInApiKey,linkedInSecretKey, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("linkedinAccessToken is" + social.GetLinkedinAccessToken()); String jsonResponse = social.ToString(); } }NSString *userName = @"Nick"; NSString *accessToken = @"<Enter LinkedIn Access Token>"; NSString *accessTokenSecret = @"<Enter LinkedIn Access Token Secret>"; NSString *linkedInApiKey = @"<Enter LinkedIn Api Key>"; NSString *linkedInSecretKey = @"<Enter LinkedIn Secret Key>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService linkUserLinkedInAccount:userName apiKey:linkedInApiKey secretKey:linkedInSecretKey accessToken:accessToken accessTokenSecret:accessTokenSecret completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"userName is %@",social.userName); NSLog(@"linkedinAccessToken is %@",social.linkedinAccessToken); NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let accessToken = "<Enter LinkedIn Access Token>" let accessTokenSecret = "<Enter LinkedIn Access Token Secret>" let linkedInApiKey = "<Enter LinkedIn Api Key>" let linkedInSecretKey = "<Enter LinkedIn Secret Key>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.linkUserLinkedInAccount(userName, apiKey:linkedInApiKey, secretKey:linkedInSecretKey,accessToken:accessToken, accessTokenSecret:accessTokenSecret,completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("userName is %@",social.userName) NSLog("linkedinAccessToken is %@",social.linkedinAccessToken) NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; String linkedInApiKey = "<Enter LinkedIn Api Key>"; String linkedInSecretKey = "<Enter LinkedIn Secret Key>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserLinkedInAccount(userName, accessToken,accessTokenSecret,linkedInApiKey,linkedInSecretKey); System.out.println("userName is " + social.getUserName()); System.out.println("linkedinAccessToken is " + social.getLinkedinAccessToken()); System.out.println("linkedinAccessTokenSecret is " + social.getLinkedinAccessTokenSecret()); System.out.println("LinkedinApiKey" + social.getLinkedinApiKey()); System.out.println("LinkedinSecretKey" + social.getLinkedinSecretKey()); String jsonResponse = social.toString();String userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; String linkedInApiKey = "<Enter LinkedIn Api Key>"; String linkedInSecretKey = "<Enter LinkedIn Secret Key>"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.LinkUserLinkedInAccount(userName, accessToken, accessTokenSecret, linkedInApiKey, linkedInSecretKey, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); App42Log.Console("linkedinAccessToken is" + social.GetLinkedinAccessToken()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", accessToken = "<Enter LinkedIn Access Token>", accessTokenSecret = "<Enter LinkedIn Access Token Secret>", linkedInApiKey = "<Enter LinkedIn Api Key>", linkedInSecretKey = "<Enter LinkedIn Secret Key>", social ; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.linkUserLinkedInAccountWithCredentials(userName, accessToken,accessTokenSecret,linkedInApiKey,linkedInSecretKey,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("userName is " + social.userName) console.log("linkedinAccessToken is" + social.linkedinAccessToken) }, error: function(error) { } });local userName = "Nick" local accessToken = "<Enter LinkedIn Access Token>" local accessTokenSecret = "<Enter LinkedIn Access Token Secret>" local linkedInApiKey = "<Enter LinkedIn Api Key>" local linkedInSecretKey = "<Enter LinkedIn Secret Key>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:linkUserLinkedInAccountWithCredentials(userName,accessToken, accessTokenSecret, linkedInApiKey,linkedInSecretKey ,App42CallBack) function App42CallBack:onSuccess(object) print("userName is " ..object:getUserName()); print("linkedinAccessToken is " ..object:getLinkedinAccessToken()); print("linkedinAccessTokenSecret is " ..object:getLinkedinAccessTokenSecret()); print("LinkedinApiKey" ..object:getLinkedinApiKey()); print("LinkedinSecretKey" ..object:getLinkedinSecretKey()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* linkedinApiKey = "<Enter LinkedIn Api Key>"; const char* linkedinSecretKey = "<Enter LinkedIn Secret Key>"; const char* linkedinAccessToken = "<Enter LinkedIn Access Token>"; const char* linkedinAccessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserLinkedInAccount(userName, linkedinApiKey, linkedinSecretKey, linkedinAccessToken, linkedinAccessTokenSecret, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nLinkedInAccessToken=%s",app42SocialResponse->social.getLinkedinAccessToken().c_str()); printf("\nLinkedInAccessTokenSecret=%s",app42SocialResponse->social.getLinkedinAccessTokenSecret().c_str()); printf("\nLinkedinApiKey=%s",app42SocialResponse->social.getLinkedinApiKey().c_str()); printf("\nLinkedinSecretKey=%s",app42SocialResponse->social.getLinkedinSecretKey().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; String linkedInApiKey = "<Enter LinkedIn Api Key>"; String linkedInSecretKey = "<Enter LinkedIn Secret Key>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.LinkUserLinkedInAccount(userName, accessToken,accessTokenSecret,linkedInApiKey,linkedInSecretKey); Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("linkedinAccessToken is" + social.GetLinkedinAccessToken()); String jsonResponse = social.ToString();$userName = "Nick"; $accessToken = "<Enter LinkedIn Access Token>"; $accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; $linkedInApiKey = "<Enter LinkedIn Api Key>"; $linkedInSecretKey = "<Enter LinkedIn Secret Key>"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->linkUserLinkedInAccount($userName, $accessToken,$accessTokenSecret,$linkedInApiKey,$linkedInSecretKey); print_r("userName is" . $social->getUserName()); print_r("LinkedinAccessToken" . $social->getLinkedinAccessToken()); print_r("LinkedinAccessTokenSecret" . $social->getLinkedinAccessTokenSecret()); print_r("LinkedinApiKey" . $social->getLinkedinApiKey()); print_r("LinkedinSecretKey" . $social->getLinkedinSecretKey()); $jsonResponse = $social->toString();const char* userName = "Nick"; const char* linkedinApiKey = "<Enter LinkedIn Api Key>"; const char* linkedinSecretKey = "<Enter LinkedIn Secret Key>"; const char* linkedinAccessToken = "<Enter LinkedIn Access Token>"; const char* linkedinAccessTokenSecret = "<Enter LinkedIn Access Token Secret>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->LinkUserLinkedInAccount(userName, linkedinApiKey, linkedinSecretKey, linkedinAccessToken, linkedinAccessTokenSecret, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nLinkedInAccessToken=%s",app42SocialResponse->social.getLinkedinAccessToken().c_str()); printf("\nLinkedInAccessTokenSecret=%s",app42SocialResponse->social.getLinkedinAccessTokenSecret().c_str()); printf("\nLinkedinApiKey=%s",app42SocialResponse->social.getLinkedinApiKey().c_str()); printf("\nLinkedinSecretKey=%s",app42SocialResponse->social.getLinkedinSecretKey().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }user_name = "Nick"; access_token = "<Enter LinkedIn Access Token>"; access_token_secret = "<Enter LinkedIn Access Token Secret>"; api_key = "<Enter LinkedIn Api Key>"; secret_key = "<Enter LinkedIn Secret Key>"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") social_service = api.build_social_service() social = social_service.link_user_linkedIn_account_with_token(user_name, access_token, access_token_secret, api_key, secret_key); puts "userName is #{social.user_name}"; puts "linkedinAccessToken is #{social.linkedin_access_token}"; puts "linkedinAccessTokenSecret is #{social.linkedin_access_token_secret}"; puts "linkedinApiKey is #{social.linkedin_api_key}"; puts "linkedinSecretKey is #{social.linkedin_secret_key}"; response = social.response(); json_response = social.to_s();var userName:String = "Nick"; var accessToken:String = "<Enter LinkedIn Access Token>"; var accessTokenSecret:String = "<Enter LinkedIn Access Token Secret>"; var linkedInApiKey:String = "<Enter LinkedIn Api Key>"; var LinkedInSecretKey:String = "<Enter LinkedIn Secret Key>"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.linkUserLinkedInAccountWithCredentials(userName,accessToken,accessTokenSecret,linkedInApiKey,LinkedInSecretKey, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var social:Social = Social(response); trace("userName is " + social.getUserName()); trace("accessToken is " + social.getLinkedinAccessToken()); } }Not AvailableString userName = "Nick"; String accessToken = "<Enter LinkedIn Access Token>"; String accessTokenSecret = "<Enter LinkedIn Access Token Secret>"; String linkedInApiKey = "<Enter LinkedIn Api Key>"; String linkedInSecretKey = "<Enter LinkedIn Secret Key>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.linkUserLinkedInAccount(userName, accessToken,accessTokenSecret,linkedInApiKey,linkedInSecretKey); System.out.println("userName is " + social.getUserName()); System.out.println("linkedinAccessToken is" + social.getLinkedinAccessToken()); String jsonResponse = social.toString();
Update the LinkedIn status of the specified user.
Required Parameters
userName - Name of the user for whom the status needs to be updated.
status - Status that has to be updated.
String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.updateLinkedInStatus(userName, status, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("userName is " + social.getUserName()); System.out.println("status is " + social.getStatus()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.UpdateLinkedInStatus(userName, status, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("status is" + social.GetStatus()); String jsonResponse = social.ToString(); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; NSString *status = @"Nick is using the App42 API"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService updateLinkedInStatus:userName status:status completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"userName is %@",social.userName); NSLog(@"status is %@",social.status); NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" let status = "Nick is using the App42 API" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.updateLinkedInStatus(userName, status:status,completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("userName is %@",social.userName) NSLog("status is %@",social.status) NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.updateLinkedInStatus(userName, status); System.out.println("userName is " + social.getUserName()); System.out.println("status is " + social.getStatus()); String jsonResponse = social.toString();String userName = "Nick"; String status = "Nick is using the App42 API"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.UpdateLinkedInStatus(userName, status, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); App42Log.Console("status is" + social.GetStatus()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", status = "Nick is using the App42 API", social ; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.updateLinkedInStatus(userName, status,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("userName is " + social.userName) console.log("status is " + social.status) }, error: function(error) { } });local userName = "Nick" local status = "Nick is using the App42 API" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:updateLinkedInStatus(userName,status ,App42CallBack) function App42CallBack:onSuccess(object) print("userName is " ..object:getUserName()); print("status is " ..object:getStatus()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; const char* status = "Nick is using the App42 API"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->UpdateLinkedInStatus(userName, status, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nStatus=%s",app42SocialResponse->social.getStatus().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.UpdateLinkedInStatus(userName, status); Console.WriteLine("userName is" + social.GetUserName()); Console.WriteLine("status is" + social.GetStatus()); String jsonResponse = social.ToString();$userName = "Nick"; $status = "Nick is using the App42 API"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->updateLinkedInStatus($userName, $status); Print_r("userName is" . $social->getUserName()); Print_r("status is" . $social->getStatus()); $jsonResponse = $social->toString();const char* userName = "Nick"; const char* status = "Nick is using the App42 API"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->UpdateLinkedInStatus(userName, status, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); printf("\nUserName=%s",app42SocialResponse->social.getUserName().c_str()); printf("\nStatus=%s",app42SocialResponse->social.getStatus().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }user_name = "Nick"; status = "Nick is using the App42 API"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") social_service = api.build_social_service() social = social_service.update_linkedIn_status(user_name, api_key, secret_key, access_token, access_token_secret); puts"userName is #{social.user_name}"; puts "linkedinApiKey is #{social.linkedin_api_key}"; puts "linkedinSecretKey is #{social.linkedin_secret_key}"; puts "linkedinAccessToken is #{social.linkedin_access_token}"; puts "linkedinAccessTokenSecret is #{social.linkedin_access_token_secret}"; response = social.response(); json_response = social.to_s();var userName:String = "Nick"; var status:String = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.updateLinkedInStatus(userName,status, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("userName is " + social.getUserName()); trace("status is " + social.getStatus()); } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.updateLinkedInStatus(userName, status); System.out.println("userName is " + social.getUserName()); System.out.println("fb Access Token is " + social.getStatus()); String jsonResponse = social.toString();
Share your link on Facebook based on access token.
Required Parameters
accessToken - Facebook Access Token that has been received after authorization.
link - Link which has to be posted on Facebook wall.
message - Message which has to be posted with the Link.
String accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.facebookLinkPost(accessToken, link, message, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.FacebookLinkPost(accessToken, link, message, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("app42Response is" + app42Response); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *accessToken = @"<Enter Facebook Access Token>"; NSString *message = @"Welcome to ShepHertz"; NSString *link = @"http://www.shephertz.com"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService facebookLinkPost:accessToken link:link message:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSLog(@"response=%@",response.strResponse); NSLog(@"isResponseSuccess=%d",response.isResponseSuccess); NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let accessToken = "<Enter Facebook Access Token>" let message = "Welcome to ShepHertz" let link = "http://www.shephertz.com" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.facebookLinkPost(accessToken, link:link,message:message,completionBlock:{ (success, response, exception) -> Void in if (success) { let response = response as! App42Response NSLog("response=%@",response.strResponse) NSLog("isResponseSuccess=%d",response.isResponseSuccess) NSLog("Response String is %@", response.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); App42Response app42Response = socialService.facebookLinkPost(accessToken, link, message); System.out.println("app42Response is" + app42Response);String accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.FacebookLinkPost(accessToken, link, message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is" + app42Response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var accessToken = "<Enter Facebook Access Token>", link = "http://www.shephertz.com/", message = "Welcome to ShepHertz", result; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.facebookLinkPost(accessToken, link,message,{ success: function(object) { var app42esponse = JSON.parse(object); result = app42esponse.app42.response; console.log("responses is " + result) }, error: function(error) { } });local accessToken = "<Enter Facebook Access Token>" local link = "http://www.shephertz.com/" local message = "Welcome to ShepHertz" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:facebookLinkPost(accessToken, link, message,App42CallBack) function App42CallBack:onSuccess(object) print("Response is :"..object:getStrResponse()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* link = "http://www.shephertz.com/"; const char* message = "Welcome to ShepHertz"; const char* accessToken = "<Enter Facebook Access Token>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->FacebookLinkPost(accessToken, link, message, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); App42Response app42Response = socialService.FacebookLinkPost(accessToken, link, message); Console.WriteLine("app42Response is" + app42Response);$accessToken = "<Enter Facebook Access Token>"; $link = "http://www.shephertz.com/"; $message = "Welcome to ShepHertz"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $app42Response = $socialService->facebookLinkPost($accessToken, $link,$message); print_r("Response is : ".$app42Response->toString());const char* link = "http://www.shephertz.com/"; const char* message = "Welcome to ShepHertz"; const char* accessToken = "<Enter Facebook Access Token>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->FacebookLinkPost(accessToken, link, message, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }Not Availablevar accessToken:String = "<Enter Facebook Access Token>"; var link:String = "http://www.shephertz.com/"; var message:String = "Welcome to ShepHertz"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.facebookLinkPost(accessToken, link, message,new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42Response:App42Response = App42Response(response); trace("app42Response is : " + app42Response); } public function onException(exception:App42Exception):void { trace("Exception is : "+ exception); } }Not AvailableString accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); App42Response app42Response = socialService.facebookLinkPost(accessToken, link, message); System.out.println("app42Response is" + app42Response);
Share your link on Facebook based on custom image and message.
Required Parameters
accessToken - Facebook Access Token that has been received after authorization.
link - Link which has to be posted on Facebook.
message - Message which has to be posted with the Link.
pictureUrl - Your thumbnail image url which you want to share on Facebook.
fileName - Name of your File which you have shared on Facebook.
description - Description of your file and Post.
String accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; String pictureUrl="https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String fileName = "Buddy Image"; String description = "Welcome to ShepHertz Home Page"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.facebookLinkPostWithCustomThumbnail(accessToken, link, message, pictureUrl, fileName, description, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; String pictureUrl="https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String fileName = "Buddy Image"; String description = "Welcome to ShepHertz Home Page"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.FacebookLinkPostWithCustomThumbnail(accessToken, link, message, pictureUrl, fileName, description, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("app42Response is" + app42Response); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *accessToken = @"<Enter Facebook Access Token>"; NSString *link = @"http://www.shephertz.com"; NSString *message = @"Welcome to ShepHertz"; NSString *pictureUrl = @"https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; NSString *fileName = @"Buddy Image"; NSString *description = @"Welcome to ShepHertz Home Page"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService facebookLinkPostWithCustomThumbnail:accessToken link:link message:message pictureUrl:pictureUrl fileName:fileName description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSLog(@"response=%@",response.strResponse); NSLog(@"isResponseSuccess=%d",response.isResponseSuccess); NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let accessToken = "<Enter Facebook Access Token>" let link = "http://www.shephertz.com" let message = "Welcome to ShepHertz" let pictureUrl = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png" let fileName = "Buddy Image" let description = "Welcome to ShepHertz Home Page" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.facebookLinkPostWithCustomThumbnail(accessToken, link:link,message:message,pictureUrl:pictureUrl,fileName:fileName,description:description,completionBlock:{ (success, response, exception) -> Void in if (success) { let response = response as! App42Response NSLog("response=%@",response.strResponse) NSLog("isResponseSuccess=%d",response.isResponseSuccess) NSLog("Response String is %@", response.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; String pictureUrl="https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String fileName = "Buddy Image"; String description = "Welcome to ShepHertz Home Page"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); App42Response app42Response = socialService.facebookLinkPostWithCustomThumbnail(accessToken, link, message, pictureUrl, fileName, description); System.out.println("app42Response is" + app42Response);String accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; String pictureUrl="https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String fileName = "Buddy Image"; String description = "Welcome to ShepHertz Home Page"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.FacebookLinkPostWithCustomThumbnail(accessToken, link, message, pictureUrl, fileName, description, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is" + app42Response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var accessToken = "<Enter Facebook Access Token>", link = "http://www.shephertz.com/", message = "Welcome to ShepHertz", pictureUrl="https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png", fileName = "Buddy Image", description = "Welcome to ShepHertz Home Page", app42Response; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.facebookLinkPostWithCustomThumbnail(accessToken, link,message,pictureUrl, fileName, description,{ success: function(object) { var result = JSON.parse(object); app42Response = result.app42.response; console.log("app42Response is : " + app42Response) }, error: function(error) { } });local accessToken = "<Enter Facebook Access Token>" local link = "http://www.shephertz.com/" local message = "Welcome to ShepHertz" local pictureUrl="https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png" local fileName = "Buddy Image" local description = "Welcome to ShepHertz Home Page" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:facebookLinkPostWithCustomThumbnail(accessToken,link,message,pictureUrl,fileName, description,App42CallBack) function App42CallBack:onSuccess(object) print("Response is :"..object:getStrResponse()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* link = "http://www.shephertz.com/"; const char* message = "Welcome to ShepHertz"; const char* accessToken = "<Enter Facebook Access Token>"; const char* pictureUrl = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; const char* fileName = "Buddy Image"; const char* description = "Welcome to ShepHertz Home Page"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->FacebookLinkPostWithCustomThumbnail(accessToken, link, message,pictureUrl,fileName,description, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; String pictureUrl="https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String fileName = "Buddy Image"; String description = "Welcome to ShepHertz Home Page"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); App42Response app42Response = socialService.FacebookLinkPostWithCustomThumbnail(accessToken, link, message, pictureUrl, fileName, description); Console.WriteLine("app42Response is" + app42Response);$accessToken = "<Enter Facebook Access Token>"; $link = "http://www.shephertz.com/"; $message = "Welcome to ShepHertz"; $pictureUrl="https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; $fileName = "Buddy Image"; $description = "Welcome to ShepHertz Home Page"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $app42Response = $socialService->facebookLinkPostWithCustomThumbnail($accessToken,$link,$message,$pictureUrl,$fileName,$description); print_r("Response is : ".$app42Response->toString());const char* link = "http://www.shephertz.com/"; const char* message = "Welcome to ShepHertz"; const char* accessToken = "<Enter Facebook Access Token>"; const char* pictureUrl = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; const char* fileName = "Buddy Image"; const char* description = "Welcome to ShepHertz Home Page"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->FacebookLinkPostWithCustomThumbnail(accessToken, link, message,pictureUrl,fileName,description, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }Not Availablevar accessToken:String = "<Enter Facebook Access Token>"; var link:String = "http://www.shephertz.com/"; var message:String = "Welcome to ShepHertz"; var pictureUrl:String="https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; var fileName:String = "Buddy Image"; var description:String = "Welcome to ShepHertz Home Page"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.facebookLinkPostWithCustomThumbnail(accessToken, link, message, pictureUrl, fileName, description,new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42Response:App42Response = App42Response(response); trace("app42Response is : " + app42Response); } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString accessToken = "<Enter Facebook Access Token>"; String link = "http://www.shephertz.com/"; String message = "Welcome to ShepHertz"; String pictureUrl="https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String fileName = "Buddy Image"; String description = "Welcome to ShepHertz Home Page"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); App42Response app42Response = socialService.facebookLinkPostWithCustomThumbnail(accessToken, link, message, pictureUrl, fileName, description); System.out.println("app42Response is" + app42Response);
Fetch the profile info likes profile picture ,Facebook ID and name of the user based on Facebook access token.
Required Parameters
accessToken - Access Token of the user for which Profile Info has to be fetched.
String accessToken = "<Enter Facebook Access Token>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.getFacebookProfile(accessToken, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println("FacebookAccessToken is:"+social.getFacebookAccessToken()); System.out.println("facebookProfileId is : " + social.getFacebookProfile().getId()); System.out.println("facebookProfileName is : " + social.getFacebookProfile().getName()); System.out.println("facebookProfileImage is : " + social.getFacebookProfile().getPicture()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String accessToken = "<Enter Facebook Access Token>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.GetFacebookProfile(accessToken, new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Social social = (Social) response; Console.WriteLine("facebookProfileId is : " + social.GetFacebookProfile().GetId()); Console.WriteLine("facebookProfileName is : " + social.GetFacebookProfile().GetName()); Console.WriteLine("facebookProfileImage is : " + social.GetFacebookProfile().GetPicture()); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *accessToken = @"<Enter Facebook Access Token>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService getFacebookProfile:accessToken completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSLog(@"Name=%@",social.facebookProfile.name); NSLog(@"Picture=%@",social.facebookProfile.picture); NSLog(@"Id=%@",social.facebookProfile.fbId); NSString *jsonResponse = [social toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let accessToken = "<Enter Facebook Access Token>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.getFacebookProfile(accessToken,completionBlock:{ (success, response, exception) -> Void in if (success) { let social = response as! Social NSLog("Name=%@",social.facebookProfile.name); NSLog("Picture=%@",social.facebookProfile.picture); NSLog("Id=%@",social.facebookProfile.fbId); NSLog("Response String is %@", social.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String accessToken = "<Enter Facebook Access Token>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.getFacebookProfile(accessToken); System.out.println("FacebookAccessToken is:"+social.getFacebookAccessToken()); System.out.println("facebookProfileId is : " + social.getFacebookProfile().getId()); System.out.println("facebookProfileName is : " + social.getFacebookProfile().getName()); System.out.println("facebookProfileImage is : " + social.getFacebookProfile().getPicture());String accessToken = "<Enter Facebook Access Token>"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.GetFacebookProfile(accessToken, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("facebookProfileId is : " + social.GetFacebookProfile().GetId()); App42Log.Console("facebookProfileName is : " + social.GetFacebookProfile().GetName()); App42Log.Console("facebookProfileImage is : " + social.GetFacebookProfile().GetPicture()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var accessToken = "<Enter Facebook Access Token>", social; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.getFacebookProfile(accessToken,{ success: function(object) { var response = JSON.parse(object); social = response.app42.response.social; console.log("facebookProfileId is : " + social.me.id) console.log("facebookProfileName is : " + social.me.name) console.log("facebookProfileImage is : " + social.me.picture) }, error: function(error) { } });local accessToken = "<Enter Facebook Access Token>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:getFacebookProfile(accessToken,App42CallBack) function App42CallBack:onSuccess(object) print("FacebookAccessToken is:"..object:getFacebookAccessToken()); print("Id is : " ..object:getFacebookProfile():getId()); print("Picture is :" ..object:getFacebookProfile():getPicture()); print("Name is : " ..object:getFacebookProfile():getName()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* accessToken = "<Enter Facebook Access Token>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->GetFacebookProfile(accessToken, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); /** * Getting facebook profile */ printf("\nName=%s", app42SocialResponse->facebookProfile.getName().c_str()); printf("\nFbId=%s", app42SocialResponse->facebookProfile.getFbId().c_str()); printf("\nPicture=%s", app42SocialResponse->facebookProfile.getPicture().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String accessToken = "<Enter Facebook Access Token>"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); Social social = socialService.GetFacebookProfile(accessToken); Console.WriteLine("facebookProfileId is : " + social.GetFacebookProfile().GetId()); Console.WriteLine("facebookProfileName is : " + social.GetFacebookProfile().GetName()); Console.WriteLine("facebookProfileImage is : " + social.GetFacebookProfile().GetPicture());$accessToken = "<Enter Facebook Access Token>"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $social = $socialService->getFacebookProfile($accessToken); print_r("FacebookAccessToken is:".$social->getFacebookAccessToken()); print_r("facebookProfileId is : ".$social->getFacebookProfile()->getId()); print_r("facebookProfileName is : " .$social->getFacebookProfile()->getName()); print_r("facebookProfileImage is : ".$social->getFacebookProfile()->getPicture());const char* accessToken = "<Enter Facebook Access Token>"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->GetFacebookProfile(accessToken, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); /** * Getting facebook profile */ printf("\nName=%s", app42SocialResponse->facebookProfile.getName().c_str()); printf("\nFbId=%s", app42SocialResponse->facebookProfile.getFbId().c_str()); printf("\nPicture=%s", app42SocialResponse->facebookProfile.getPicture().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }Not Availablevar accessToken:String = "<Enter Facebook Access Token>"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.getFacebookProfile(accessToken,new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("facebookProfileName is : " + FacebookProfile(social.getFaceBookProfile()).getName()); trace("facebookProfileId is : " + FacebookProfile(social.getFaceBookProfile()).getId()); trace("facebookProfileImage is : " + FacebookProfile(social.getFaceBookProfile()).getPicture()); } public function onException(excption:App42Exception):void { trace("Exception Message"); } }Not AvailableString accessToken = "<Enter Facebook Access Token>"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); Social social = socialService.getFacebookProfile(accessToken); System.out.println("facebookProfileId is : " + social.getFacebookProfile().getId()); System.out.println("facebookProfileName is : " + social.getFacebookProfile().getName()); System.out.println("facebookProfileImage is : " + social.getFacebookProfile().getPicture());
Share your file on Facebook wall based on Facebook access token.
Required Parameters
accessToken - Facebook Access Token that has been received after authorization.
fileName - Name of the file which you want to upload.
filePath - Local path of the file.
message - Message which has to be posted with the Link.
String accessToken = "<Enter Facebook Access Token>"; String fileName = "Buddy Image"; String filePath = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String message = "Welcome to ShepHertz"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.facebookPublishStream(accessToken,fileName,filePath,message,new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String accessToken = "<Enter Facebook Access Token>"; String fileName = "Buddy Image"; String filePath = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String message = "Welcome to ShepHertz"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.FacebookPublishStream(accessToken, fileName, filePath, message, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception is : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("app42Response is" + app42Response); } }NSString *accessToken = @"<Enter Facebook Access Token>"; NSString *fileName = @"Buddy Image"; NSString *filePath = @"https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; NSString *message = @"Welcome to ShepHertz"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService facebookPublishStream:accessToken fileName:fileName filePath:filePath message:message completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSLog(@"response=%@",response.strResponse); NSLog(@"isResponseSuccess=%d",response.isResponseSuccess); NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let accessToken = "<Enter Facebook Access Token>" let fileName = "Buddy Image" let filePath = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png" let message = "Welcome to ShepHertz" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let socialService = App42API.buildSocialService as! SocialService socialService?.facebookPublishStream(accessToken,fileName:fileName, filePath:filePath, message:message, completionBlock:{ (success, response, exception) -> Void in if (success) { let response = response as! App42Response NSLog("response=%@",response.strResponse); NSLog("isResponseSuccess=%d",response.isResponseSuccess); NSLog("Response String is %@", response.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String accessToken = "<Enter Facebook Access Token>"; String fileName = "Buddy Image"; String filePath = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String message = "Welcome to ShepHertz"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); App42Response social = socialService.facebookPublishStream(accessToken, fileName, filePath, message); System.out.println("response is " + social) ; String jsonResponse = social.toString();String accessToken = "<Enter Facebook Access Token>"; String fileName = "Buddy Image"; String filePath = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String message = "Welcome to ShepHertz"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.FacebookPublishStream(accessToken, fileName, filePath, message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is" + app42Response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var accessToken = "<Enter Facebook Access Token>", fileName = "Buddy Image", filePath = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png", message = "Welcome to ShepHertz", app42Response; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.facebookPublishStream(accessToken, fileName, filePath, message,{ success: function(object) { var response = JSON.parse(object); app42Response = response.app42.response; console.log("app42Response is : " + app42Response) }, error: function(error) { } });Coming Soonconst char* accessToken = "<Enter Facebook Access Token>"; const char* filePath = "Your File Path"; const char* fileName = "<Your_file_name>"; const char* message = "Welcome to ShepHertz"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->FacebookPublishStream(accessToken, fileName, filePath.c_str(), message, app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }String accessToken = "<Enter Facebook Access Token>"; String fileName = "Buddy Image"; String filePath = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String message = "Welcome to ShepHertz"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); App42Response app42Response = socialService.FacebookPublishStream(accessToken, fileName, filePath, message); Console.WriteLine("app42Response is" + app42Response);$accessToken = "<Enter Facebook Access Token>"; $fileName = "Buddy Image"; $filePath = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; $message = "Welcome to ShepHertz"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); $app42Response = $socialService->facebookPublishStream($accessToken,$fileName, $filePath, $message); print_r("Response is : ".$app42Response->toString());const char* accessToken = "<Enter Facebook Access Token>"; const char* filePath = "Your File Path"; const char* fileName = "<Your_file_name>"; const char* message = "Welcome to ShepHertz"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->FacebookPublishStream(accessToken, fileName, filePath.c_str(), message, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); printf("\nResponse Body=%s",app42SocialResponse->getBody().c_str()); } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); } }Not AvailableComing soonNot AvailableString accessToken = "<Enter Facebook Access Token>"; String fileName = "Buddy Image"; String filePath = "https://apis.shephertz.com/images/cloud-api-services/app42-cloud-api-services.png"; String message = "Welcome to ShepHertz"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); App42Response social = socialService.facebookPublishStream(accessToken, fileName, filePath, message); String jsonResponse = social.toString();
The functions available under Social API can throw some exceptions in abnormal conditions. If a developer is linking the User’s Twitter account name who has not authorized the app to use his account, the function will throw the App42Exception (as shown below) with message as “Not Found” and the appErrorCode as “3800” and the details as “Twitter App Credentials (ConsumerKey / ConsumerSecret) does not exist”.
String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); socialService.updateTwitterStatus(userName, status, new App42CallBack() { public void onSuccess(Object response) { Social social = (Social)response; System.out.println(social); System.out.println("userName is :" + social.getUserName()); System.out.println("Status is : " + social.getStatus()); } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.getMessage(); } });String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.UpdateTwitterStatus(userName, status, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } public void OnSuccess(Object response) { Social social = (Social) response; String jsonResponse = social.ToString(); } }NSString *userName = @"Nick"; NSString *status = @"Nick is using the App42 API"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; SocialService *socialService = [App42API buildSocialService]; [socialService updateTwitterStatus:userName status:status completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Social *social = (Social*)responseObj; NSString *jsonResponse = [social toString]; } else { int appErrorCode = ex.appErrorCode; int httpErrorCode = ex.httpErrorCode; if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } NSString *jsonText = ex.reason; } }];Coming SoonString userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); try { Social social = socialService.updateTwitterStatus(userName, status); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.getMessage(); }String userName = "Nick"; String status = "Nick is using the App42 API"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); socialService.UpdateTwitterStatus(userName, status, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Social social = (Social) response; App42Log.Console("userName is" + social.GetUserName()); App42Log.Console("status is" + social.GetStatus()); } public void OnException(Exception e) { App42Exception ex = (App42Exception)e; int appErrorCode = ex.GetAppErrorCode(); int httpErrorCode = ex.GetHttpErrorCode(); if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.GetMessage(); } }var userName = "Nick", appErrorCode , status = "Nick is using the App42 API"; App42.initialize("API_KEY","SECRET_KEY"); var socialService = new App42Social(); socialService.updateTwitterStatus(userName, status,{ success: function(object) { }, error: function(error) { var socialObj = JSON.parse(error); appErrorCode = socialObj.app42Fault.appErrorCode; if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } });local userName = "Nick" local status = "Nick is using the App42 API" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local socialService = App42API:buildSocialService() socialService:updateTwitterStatus(userName, status ,App42CallBack) function App42CallBack:onSuccess(object) print("Response Success is "..object:getResponseSuccess()) end function App42CallBack:onException(exception) local appErrorCode = exception:getAppErrorCode() if appErrorCode == 3800 then -- Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) elseif appErrorCode == 3801 then -- Handle here for Bad Request (The request is Unauthorized with the provided credentials.) elseif appErrorCode == 3802 then -- Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) elseif appErrorCode == 3803 then -- Handle here for Bad Request (The Twitter Access Credentials are invalid.) elseif appErrorCode == 1401 then -- handle here for Client is not authorized elseif appErrorCode == 1500 then -- handle here for Internal Server Error end endconst char* userName = "Nick"; const char* status = "Nick is using the App42 API"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->UpdateTwitterStatus(userName, status,app42callback(Sample_Class::onSocialServiceRequestCompleted, this)); void Sample_Class::onSocialServiceRequestCompleted(void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); // Handle success response here } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); int appErrorCode = app42SocialResponse->appErrorCode; int httpErrorCode = app42SocialResponse->httpErrorCode; if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }String userName = "Nick"; String status = "Nick is using the App42 API"; App42API.Initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.BuildSocialService(); try { Social social = socialService.UpdateTwitterStatus(userName, status); } catch(App42Exception ex) { int appErrorCode = ex.GetAppErrorCode(); int httpErrorCode = ex.GetHttpErrorCode(); if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.GetMessage(); }$userName = "Nick"; $status = "Nick is using the App42 API"; App42API::initialize("API_KEY","SECRET_KEY"); $socialService = App42API::buildSocialService(); try { $social = $socialService->updateTwitterStatus($userName, $status); } catch(App42Exception $ex) { $appErrorCode = $ex->getAppErrorCode(); $httpErrorCode = $ex->getHttpErrorCode(); if($appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if($appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if($appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if($appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if($appErrorCode == 1401) { // handle here for Client is not authorized } else if($appErrorCode == 1500) { // handle here for Internal Server Error } $jsonText = $ex->getMessage(); }const char* userName = "Nick"; const char* status = "Nick is using the App42 API"; App42API::Initialize("API_KEY", "SECRET_KEY"); SocialService *socialService = App42API::BuildSocialService(); socialService->UpdateTwitterStatus(userName, status, this, app42callfuncND_selector(Sample_Class::onSocialServiceRequestCompleted)); void Sample_Class::onSocialServiceRequestCompleted(App42CallBack *sender, void *response) { App42SocialResponse *app42SocialResponse = (App42SocialResponse*)response; if(app42SocialResponse->isSuccess) { printf("\ncode=%d",app42SocialResponse->getCode()); printf("\nisSuccess=%d",app42SocialResponse->isSuccess); // Handle success response here } else { printf("\nerrordetails:%s",app42SocialResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42SocialResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42SocialResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42SocialResponse->httpErrorCode); int appErrorCode = app42SocialResponse->appErrorCode; int httpErrorCode = app42SocialResponse->httpErrorCode; if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }Coming Soonvar userName:String = "Nick"; var status:String = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); var socialService:SocialService = App42API.buildSocialService(); socialService.updateTwitterStatus(userName,status, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var social:Social = Social(response); trace("response is :" + social) } public function onException(exception:App42Exception):void { var appErrorCode:int = exception.getAppErrorCode(); var httpErrorCode:int = exception.getHttpErrorCode(); if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }Coming SoonString userName = "Nick"; String status = "Nick is using the App42 API"; App42API.initialize("API_KEY","SECRET_KEY"); SocialService socialService = App42API.buildSocialService(); try { Social social = socialService.updateTwitterStatus(userName, status); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 3800) { // Handle here for Not Found (Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.) } else if(appErrorCode == 3801) { // Handle here for Bad Request (The request is Unauthorized with the provided credentials.) } else if(appErrorCode == 3802) { // Handle here for Not Found (Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.) } else if(appErrorCode == 3803) { // Handle here for Bad Request (The Twitter Access Credentials are invalid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.getMessage(); }
Functions in Session API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The Request parameters are invalid.
1401 - UNAUTHORIZED - Client is not authorized.
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again.
3800 - NOT FOUND - Twitter App Credentials(ConsumerKey / ConsumerSecret) does not exist.
3802 - NOT FOUND - Twitter User Access Credentials does not exist. Please use linkUserTwitterAccount API to link the User Twitter account.
3803 - BAD REQUEST - The Twitter Access Credentials are invalid." + <Exception Message>.
3804 - NOT FOUND - Facebook App Credentials(ConsumerKey/ConsumerSecret) does not exist.
3805 - BAD REQUEST - The Facebook Access Credentials are invalid + <Received Facebook Exception Message>.
3806 - NOT FOUND - Facebook User Access Credentials does not exist. Please use linkUserFacebookAccount API to link the User facebook account.
3807 - NOT FOUND - LinkedIn App Credentials(ApiKey/SecretKey) does not exist.
3808 - BAD REQUEST - The Access Credentials are invalid + <Exception Message>.
3809 - NOT FOUND - LinkedIn User Access Credentials does not exist. Please use linkUserLinkedInAccount API to link the User LinkedIn account.
3810 - NOT FOUND - Social App Credentials do not exist.
3811 - NOT FOUND - User Social Access Credentials do not exist. Please use linkUserXXXXXAccount API to link the User Social account.