I got following JSON from https://api.linkedin.com/v1/people/~/network/updates
(
{
isCommentable = 0;
isLikable = 0;
timestamp = "-1";
updateContent = {
........
};
updateKey = "UPDATE-c2858344-12394303";
updateType = CMPY;
}
,......
)
In above all the array JSON,updateKey is unique like any ID.
I need to show Linkedin Update URL based on this unique updateKey to show it in webview of iOS application.
I try to found this in LinkedIn api But I not found proper solution.
Thanks in advance.
Related
Recently I am trying to use Twilio Flex Web Chat in my project and I am using a pre-engagement form for collecting user names. In the pre-engagement form based on the data collected I want to show a welcome message.I have tried this code but seems it is not working and in Twilio documentation, I can't find how to do it. Below is my code .
Twilio.FlexWebChat.createWebChat(appConfig).then(webchat => {
const { manager } = webchat;
debugger;
//Posting question from preengagement form as users first chat message
Twilio.FlexWebChat.Actions.on("afterStartEngagement", (payload) => {
const { question, friendlyName } = payload.formData;
manager.strings.PredefinedChatMessageBody = `Hi !! ${friendlyName} How we can help you?`;
if (!question)
return;
const { channelSid } = manager.store.getState().flex.session;
manager
.chatClient.getChannelBySid(channelSid)
.then(channel => channel.sendMessage(question));
});
// Changing the Welcome message
manager.strings.WelcomeMessage = "Welcome to AppsEconnect";
manager.strings.PredefinedChatMessageAuthorName = "Appseconnect Team";
manager.strings.PredefinedChatMessageBody = "{{friendlyName}} how we can help you ?";
// Render WebChat
webchat.init();
});
Check if this answer works for you:
Twilio.FlexWebChat.MainContainer.defaultProps.startEngagementOnInit = false;
manager.strings.WelcomeMessage = "Holi como estamos desgraciaoo";
Twilio.FlexWebChat.MessagingCanvas.defaultProps.predefinedMessage.body = '¡Bienvenido! ¿Con quién tengo el gusto de hablar?'
// Render WebChat
webchat.init();
During adding site links to campaign feed, I would like to set device preference for mobile to be checked.
How can I do it with ad words API ?
platformOperand.stringValue = "Mobile";//it also can be set for "Desktop"
I tried to do it like this:
ConstantOperand platformOperand = new ConstantOperand();
platformOperand.stringValue = "Mobile";//it also can be set for "Desktop"
platformOperand.type = ConstantOperandConstantType.STRING;
Function platformFunction = new Function();
platformFunction.lhsOperand = new FunctionArgumentOperand[] {
platformRequestContextOperand };
platformFunction.#operator = FunctionOperator.EQUALS;
platformFunction.rhsOperand = new FunctionArgumentOperand[] {
platformOperand };
and then it combined in function with links ids from google service and mutated for campaign feed service.
No exception and link added but when I enter to link edit, "Mobile" option remain unmarked.
Please advise.
I found the answer:
you shuld set devicePreference when you set propertes for FeedItem:
// Create the feed item and operation.
var item = new FeedItem();
item.feedId = siteLinksData.SiteLinksFeedId;
item.attributeValues = new FeedItemAttributeValue[]
{linkTextAttributeValue, linkUrlAttributeValue };
if (value.DeviceType == Device.Mobile)
{
item.devicePreference = new FeedItemDevicePreference();
item.devicePreference.devicePreference = 30001L;
item.devicePreference.devicePreferenceSpecified = true;
}
and this is most important part:
item.devicePreference = new FeedItemDevicePreference();
item.devicePreference.devicePreference = 30001L;
item.devicePreference.devicePreferenceSpecified = true;
if you wondering what the meaning of 30001L, it's device criteria IDs according to adwords API
See https://developers.google.com/adwords/api/docs/appendix/platforms
I want to retrieve all clientID from my MCC account. I'm using this code
AdWordsUser user = new AdWordsUser(adwordsPropertyService.getEmail(), adwordsPropertyService.getPassword(),
null, adwordsPropertyService.getUseragent(), adwordsPropertyService.getDeveloperToken(),
adwordsPropertyService.getUseSandbox());
InfoServiceInterface infoService = user.getService(AdWordsService.V201109.INFO_SERVICE);
InfoSelector selector = new InfoSelector();
selector.setApiUsageType(ApiUsageType.UNIT_COUNT_FOR_CLIENTS);
String today = new SimpleDateFormat("yyyyMMdd").format(new Date());
selector.setDateRange(new DateRange(today, today));
selector.setIncludeSubAccounts(true);
ApiUsageInfo apiUsageInfo = infoService.get(selector);
for (ApiUsageRecord record : apiUsageInfo.getApiUsageRecords()) {
......
But apiUsageInfo.getApiUsageRecords return my only some clientId.
Have you any suggests?
My Answer will be helpful for PHP Developers
I am using v201502(php), You will get all account details from ManagedCustomerService api. Please refer the following URL https://developers.google.com/adwords/api/docs/reference/v201502/ManagedCustomerService
This is the sample code i used,
function DisplayAccountTree($account, $link, $accounts, $links, $depth) {
print str_repeat('-', $depth * 2);
printf("%s, %s\n", $account->customerId, $account->name);
if (array_key_exists($account->customerId, $links)) {
foreach ($links[$account->customerId] as $childLink) {
$childAccount = $accounts[$childLink->clientCustomerId];
DisplayAccountTree($childAccount, $childLink, $accounts, $links,
$depth +1);
}
}
}
function GetAccountHierarchyExample(AdWordsUser $user) {
// Get the service, which loads the required classes.
$user->SetClientCustomerId('xxx-xxx-xxxx');
$managedCustomerService =
$user->GetService('ManagedCustomerService');
// Create selector.
$selector = new Selector();
// Specify the fields to retrieve.
$selector->fields = array('CustomerId', 'Name');
// Make the get request.
$graph = $managedCustomerService->get($selector);
// Display serviced account graph.
if (isset($graph->entries)) {
// Create map from customerId to parent and child links.
$childLinks = array();
$parentLinks = array();
if (isset($graph->links)) {
foreach ($graph->links as $link) {
$childLinks[$link->managerCustomerId][] = $link;
$parentLinks[$link->clientCustomerId][] = $link;
}
}
// Create map from customerID to account, and find root account.
$accounts = array();
$rootAccount = NULL;
foreach ($graph->entries as $account) {
$accounts[$account->customerId] = $account;
if (!array_key_exists($account->customerId, $parentLinks)) {
$rootAccount = $account;
}
}
// The root account may not be returned in the sandbox.
if (!isset($rootAccount)) {
$rootAccount = new Account();
$rootAccount->customerId = 0;
}
// Display account tree.
print "(Customer Id, Account Name)\n";
DisplayAccountTree($rootAccount, NULL, $accounts, $childLinks, 0);
} else {
print "No serviced accounts were found.\n";
}
}
GetAccountHierarchyExample($user);
SetClientCustomerId will be the parent ID of your all accounts, It will be appeared near the Sign Out button of you google AdWords account, Please see the attached image
I hope this answer will be helpful, Please add your comments below if you want any further help
If you need just the list of clientCustomerIds, try ServicedAccountService.
Here is a code example that shows how this may be done.
Next time, you might also want to consider asking the question on the official forum for AdWords API: https://groups.google.com/forum/?fromgroups#!forum/adwords-api
I have problem in finding the current opened application name.
I used ApplicationManager class for getting the visible applications.
The application descriptors are showing the same name for all these apps Email,Messaging,Sms,call log.
They are displaying "net_rim_bb_messaging_app" for all the above apps.
I need to find a unique identifier/name for these applications(Email,messaging,sms,calllog) when they are opened.
I tried this for the past 3 days and can't find a solution.
Can you please let me know a solution for this?
ApplicationDescriptor [] appDis = manager.getVisibleApplications();
int currentForgroundAppID = manager.getForegroundProcessId();
for(int i=0;i<appIDs.length;i++)
{
if(appDis[i].getModuleName().equals("net_rim_bb_messaging_app"))
{
//print Messaging app in foreground...
}
}
the case with in the for loop above is true for every app in this list.
Email,
Text message
Call log...
But, I need to find a unique way to find the application that was opened.
Thanks In Adv,
Satish.k
following code can display current foregroundApplication name
ApplicationDescriptor[] mAppDes;
ApplicationManager appMan = ApplicationManager.getApplicationManager();
appMan.getForegroundProcessId();
mAppDes = appMan.getVisibleApplications();
for (int i = 0; i < mAppDes.length; i++) {
boolean isFG = appMan.getProcessId(mAppDes[i]) == appMan.getForegroundProcessId();
if(isFG)
{
System.out.println("This is your Foteground application Name"+mAppDes[i].getName());
}else{
System.out.println("This is your Background application Name"+mAppDes[i].getName());
}
}
I've been experimenting with the Twitter API because I want to display a few lists of tweets on a special page.
Among those lists is a list with all tweets containing a specific hashtag (e.g. #test)
However I cannot find how to get that list in either XML or JSON (preferably the latter), does anyone know how? It is also fine if it can be done in TweetSharp
You can simply fetch http://search.twitter.com/search.json?q=%23test to get a list of tweets containing #test in JSON, where %23test is #test URL encoded.
I'm not familiar with TweetSharp, but I guess there must be a search command that you can use to search for #test, and then transform the resulting tweets into JSON yourself.
First install TweetSharp using github
https://github.com/danielcrenna/tweetsharp
Here is the code to do a search
TwitterService service = new TwitterService();
var tweets = service.Search("#Test", 100);
List<TwitterSearchStatus> resultList = new List<TwitterSearchStatus>(tweets.Statuses);
If you have more then one page results you can setup a loop and call each page
service.Search("#Test", i += 1, 100);
It seems like there is a change in the API since last few months. Here is the updated code:
TwitterSearchResult res = twitter.Search(new SearchOptions { Q = "xbox" });
IEnumerable<TwitterStatus> status = res.Statuses;
u access with this url for your tweet searchs. But u have to use OAuth protocols.
https://api.twitter.com/1.1/search/tweets.json?q=%40twitterapi
I struggled with the same problem. Here is my vague solution . Enjoy Programming.
It will get out of the function whenever your required number of tweets are acquired/fetched.
string maxid = "1000000000000"; // dummy value
int tweetcount = 0;
if (maxid != null)
{
var tweets_search = twitterService.Search(new SearchOptions { Q = keyword, Count = Convert.ToInt32(count) });
List<TwitterStatus> resultList = new List<TwitterStatus>(tweets_search.Statuses);
maxid = resultList.Last().IdStr;
foreach (var tweet in tweets_search.Statuses)
{
try
{
ResultSearch.Add(new KeyValuePair<String, String>(tweet.Id.ToString(), tweet.Text));
tweetcount++;
}
catch { }
}
while (maxid != null && tweetcount < Convert.ToInt32(count))
{
maxid = resultList.Last().IdStr;
tweets_search = twitterService.Search(new SearchOptions { Q = keyword, Count = Convert.ToInt32(count), MaxId = Convert.ToInt64(maxid) });
resultList = new List<TwitterStatus>(tweets_search.Statuses);
foreach (var tweet in tweets_search.Statuses)
{
try
{
ResultSearch.Add(new KeyValuePair<String, String>(tweet.Id.ToString(), tweet.Text));
tweetcount++;
}
catch { }
}
}