Google contacts service Contact query OrderBy parameter values - asp.net-mvc

I am using google contacts service with .net mvc and I want to load 100 most contacted persons with ContactQuery.NumberToRetrieve and ContactQuery.OrderBy.
what should I set to OrderBy to make it work?
thanks a lot

query.OrderBy = "lastmodified";
query.SortOrder = "descending";
query.NumberToRetrieve = 1000 //Convert.ToInt32(ConfigurationManager.AppSettings["NumberToRetrieve"]);

Related

How to get google user interests in french?

I'm working on google ads api to get user interests in french. Im using the search query :
$this->googleAdsServiceClient = $this->googleAdsClient->getGoogleAdsServiceClient();
$query = 'SELECT user_interest.user_interest_id,user_interest.name,user_interest.taxonomy_type FROM user_interest ORDER BY user_interest.name';
$stream = $this->googleAdsServiceClient->search($this->CUSTOMER_ID, $query);
Result for the above query is in english. I want to get it in french lanaguage. Can i achieve it by passing locale or any other parameter ?

Graph API .net SDK - Filter Me.MemberOf based on displayName of groups

I am trying to filter out the groups of a user he is a member of based on some words that the group name may contain.
I am using this code -
var groups = _graphServiceClient.Me.MemberOf.Request().Filter($"displayName -eq 'abhi'").GetAsync().Result;
but I am getting the error that filter request is invalid.
Any help with this is always appreciated, thanks.
Based on aad advanced queries here your request is supported when the request headers contains ConsistencyLevel = eventual and count = true
To get it to work here is the sample code:
List<Option> options = new List<Option>();
options.Add(new HeaderOption("ConsistencyLevel", "eventual"));
options.Add(new QueryOption("$filter", $"displayName eq 'abhi'"));
options.Add(new QueryOption("$count", "true"));
var groups = await graphServiceClient.Me
.MemberOf
.Request(options)
.GetAsync();

Microsoft Graph API Java - get group using displayName

I am using Microsoft Graph API( java SDK) to add members to the group. But I see that I could only pull a group using the "id" .But there should be an easy way to pull the group information using name or displayName? I am trying to get the group id, so that I could use it to add members
Group group = graphClient.groups("id")
.buildRequest()
.get();
Have you tried something like this?
LinkedList<Option> requestOptions = new LinkedList<Option>();
requestOptions.add(new QueryOption("$filter", "startswith(displayName, 'Hello')"));
IGroupCollectionPage groups = graphClient.groups()
.buildRequest(requestOptions)
.get();
This should filter all groups with "displayName" starting with "Hello".

How to search for multiple twitter ids in one request using twitter4j library

How to search for multiple twitter ids in one request using twitter4j library. Even using in clause in Search parameter would be helpful. Please help!
Please find some sample code below to fetch tweets based on tweet_ids.
Like other twitter API's, this API is also rate limited, in a single call you can fetch status only for 100 ids. Check the documentation for more details.
Also use latest version of twitter4j lib.
ConfigurationBuilder config = new ConfigurationBuilder();
config.setOAuthConsumerKey("consumerKey");
config.setOAuthConsumerSecret("consumerSecret");
config.setOAuthAccessToken("accessToken");
config.setOAuthAccessTokenSecret("accessSecret");
Twitter twitter = new TwitterFactory(config.build()).getInstance();
long ids[] = new long [3];
ids[0] = 568363361278296064l;
ids[1] = 568378166512726017l;
ids[2] = 570544187394772992l;
ResponseList<Status> statuses = twitter.lookup(ids);
for (Status status : statuses) {
System.out.println(status.getText());
}

Get Tweets with Pictures using twitter search api

Is it possible to get tweets which contain photos? I am currently using twitter search api and getting all the tweets having entity details by setting include_entities=true. I see picture details under media object but is there anyway to filter and get tweets objects which just have these media items. Or is there anyway in Twitter4j to do this query?
There is no specific way to specify that I need only photos or videos but you can filter the results based on filter:links or filter:images or filter:videos in your query along with include_entities=true.
For Example: To get the tweets that contain links since 2012-01-31, you query should have include_entities parameter as well as filter:links as shown as follows:
https://search.twitter.com/search.json?q=from%3Agoogle%20since%3A2012-01-31%20filter%3Alinks&include_entities=true"
As your need is to filter your tweets based on images/photos, I think you should use filter:images.
An example of your case would look like:
https://search.twitter.com/search.json?q=from%3Agoogle%20since%3A2012-01-31%20filter%3Aimages&include_entities=true"
Hope this helps.
With Latest twitter API I couldn't get filters work and I couldn't find either any explanation in their docs. Althought you can get all the tweets and then parse only the media ones. You can fire this if inside your parsing script:
if(this.entities.media != null){
//Parse the tweet
}
This is not the best solution but the worst part comes to twitter who's giving you more information and using more of its own resources.
In the lastest twitter API you can do it in the ConfigurationBuilder instance, before creating the Twitter instance:
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(false);
cb.setOAuthConsumerKey(API_KEY);
cb.setOAuthConsumerSecret(API_SECRET);
cb.setOAuthAccessToken(ACCESS_TOKEN);
cb.setOAuthAccessTokenSecret(SECRET_KEY);
// enabling include_entities parameters
cb.setIncludeEntitiesEnabled(true);
Twitter twitterInstance = new TwitterFactory(cb.build()).getInstance();
Also, after enabling the entities, in the search string you have to had the condition "filter:images".
List<String> keywords = new ArrayList<String>();
keywords.add("#pet");
keywords.add("cat");
// String.join for Java 8
String twitterSearchString = "((" + String.join(" OR ", keywords) + ")";
// adding the filter condition
twitterSearchString += " AND filter:images)";
Query q = new Query(twitterSearchString);
And you will get just results with images (tested with twitter4j-core 4.0.4).
For filter in twitter API you can check official document for latest version as on date Apr 02 2019
https://developer.twitter.com/en/docs/tweets/search/guides/standard-operators.html

Resources