Google Contacts API not showing emails, nor max results - oauth

I'm using the Google Contacts API to get back formatted JSON, hopefully containing ALL of a user's contacts' email addresses. I use this information to search my database for the user's friends.
Neither of these results occur.
Here's the URI that's called (broken up by paramater for slightly better readability:
http://www-opensocial.googleusercontent.com/api/people/#me/#all/?
filterby=emails&max_results=1000
&oauth_consumer_key=XXXXXXX
&oauth_nonce=h7ZEI
&oauth_signature=6U2ywoPRFu8iJdQhjMRk%2FZlf%2FBg%3D
&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=1283979209
&oauth_token=1%2Fwv9OYV4LuffVLv6OqlFJLOtTlBo5sYYQkHbZznlLrNk
&oauth_version=1.0
&orderby=starttime
Here's some truncated and anonymized JSON I have returned.
{
"startIndex": 0,
"totalResults": 615,
"entry": [
{
"id": "XXXXXXXXXXXXXXXXXXX",
"name": {
"formatted": "XXXXX XXXXXX",
"familyName": "XXXXXXX",
"givenName": "XXXXXX"
},
"displayName": "XXXXX XXXXXX"
},
],
"itemsPerPage": 20
}
Any thoughts on what's going wrong here would be great.

Hate to answer my own question so soon, but I was using the wrong initial scope. I was using Google's Open Social feed rather than the Google Contacts feed.

Related

Could not load facebook avatar image [duplicate]

I'm using Facebook graph API by calling https://graph.facebook.com/v2.10/me?access_token=xxxxxxxxxxxxxxxxxx&fields=id,email,name,first_name,last_name,gender,age_range,picture.width(512).height(512),locale,link,timezone,updated_time which returns the json response I was expecting. Something like this:
{
"id": "1234567890987654321",
"email": "xxxxxx\u0040example.com",
"name": "xxxx xxxx",
"first_name": "xxxx",
"last_name": "xxxx",
"gender": "xxxxx",
"age_range": {
"min": 21
},
"picture": {
"data": {
"height": 720,
"is_silhouette": false,
"url": "https://scontent.fna.fbcdn.net/v/t1.0-1/p720x720/xxx.jpg?oh=xxx",
"width": 720
}
},
"locale": "en_US",
"link": "https://www.facebook.com/app_scoped_user_id/1234567890987654321/",
"timezone": xx,
"updated_time": "2017-05-24T14:00:01+0000"
}
However, on calling the url child node of the picture, nothing was returned. I copied the actual link and paste it in Google Chrome browser and DNS_PROBE_FINISHED_NXDOMAIN error is returned.
I checked the image used by the Facebook website, I noticed that it's pointing to a different base url: https://scontent.fjnb2-1.fna.fbcdn.net, while mine is pointing to https://scontent.fna.fbcdn.net. The returned url on graph is missing .fjnb2-1 and it works when I added it.
Is this a known bug on Facebook Graph API?
Is it ok to change the base url to include the missing part?
Any other way to fix this issue without running into another issue later when Facebook decided to change the return url?
This is a known bug which has already been reported by many developers on https://developers.facebook.com/bugs and I believe the Facebook team is working on resolving this.
Edit:
I can confirm that this issue has been resolved by Facebook Dev Team now.

Ruby on rails: Substring with quotes search inside JSON object

I have retrieved a json object using typhoeus gem.
url = 'www.example.com' <br>
request = ::Typhoeus::Request.get(url,userpwd: username + ":" + pass)<br>
content = JSON.parse(request.body)
I would like to count the occurence of "Priority":"high" including the quotes inside the json response. How do I go about doing this?
Edit:
"priority":"high" is a key value pair. It is deeply nested inside the json tree.(Don't how deeply it is nested). All I need is count of occurence of "priority":"high"
Any and all suggestion is welcome.
Sample data:
"tickets": [{
"url": "https://.zendesk.com/api/v2/tickets/xxxx.json",
"id": xxxxx,
"external_id": null,
"via": {
"channel": "email",
"source": {
"from": {
"address": "#compli.com",
"name": ""
},
"to": {
"name": "organization Global Support",
"address": "support#organization.zendesk.com"
},
"rel": null
}
},
"created_at": "2016-08-04T16:23:13Z",
"updated_at": "2016-08-08T20:26:01Z",
"type": "problem",
"subject": "Problems with abc Connect",
"raw_subject": "Problems with abc Connect",
"description": "Hi – our Tenet ID is 5675.\n\n \n\nThe abc report is not providing the full data when I run the billing preview. I am running it using Chrome. Attached are snapshots of what I’m doing plus the report generated.\n\n \n\nA perfect example of the problem is shown at the bottom of the report generated. Garber Automotive Group, account number A00000490 does not display the data for all of their products. Their data is shown on rows 5658 thru 5712 on the excel file BillingPreviewResult_201620 report run 08.04.16.\n\n \n\nHowever the EXACT same report (all the parameters are the same) run on 07/01/16 included all of Garber’s information. The excel file abc report run 07.01.16 10.13 AM has the data for Garber on rows 6099 – 6182.\n\n \n\nThe report is cutting off a lot of data for some reason. As you can see by comparing the amount of data between the two excel reports there are much fewer lines on the report run on today as opposed to the one run on 07/01, 6182 rows vs 5712 rows.\n\n \n\nThis is a business critical report for us. It is used for cash forecasting, monthly financial reporting, rolling budgeting and ad hoc reporting.\n\n \n\nWe need this problem identified and fixed immediately. It is already causing a problem with finalizing our July results.\n\n \n\nLet me know if you have any questions or need any additional data.\n\n \n\n \n\nRegards,\n\n \n\n \n\n \n\n| Controller\ndesk: 503.963-4239 | fax: 503.294.1200 | \n\nCompli - Cool, Calm and Compliant. TM\n\nVisit() to learn more.\n\n \n\nFollow us on LinkedIn () and Twitter",
"priority": "normal",
"status": "open",
"recipient": "support#organization.zendesk.com",
"requester_id": 1336424406,
"submitter_id": 1336424406,
"assignee_id": null,
"organization_id": 224504969,
"group_id": 21606503,
"collaborator_ids": [560973773, 786229209, 421597631, 539566717, 707192615, 1336424406, 31365392, 719608577, 1817633993],
"forum_topic_id": null,
"problem_id": null,
"has_incidents": false,
"due_at": null,
"tags": ["1_price", "best_practice_advise", "engage_global_services__email_", "escalate", "hard", "internal_escalation", "p0", "yes_escalated", "xxxxx", "zhub"],
"custom_fields": [{
"id": 22024091,
"value": "p0"
}, {
"id": 24212576,
"value": "best_practice_advise"
}, {
"id": 22035048,
"value": "xxx and so on.....

Twitter api - trends/place

I have a question regarding the trends/place REST API of Twitter.
This API, according to Twitter "returns the top 50 trending topic for a specific WOEID, if trending information is available for it."
Thus it returns a list of trend topic dictionaries with the topic in the name field, all in json format
One of the fields returned in the response is the tweet_volume. My question is whether the tweet_volume represents the volume just for that WOEID, or whether this is the tweet volume across all of Twitter.
Here is a sample:
[
{
"created_at": "2015-12-23T10:26:00Z",
"trends": [
{
"url": "http://twitter.com/search?q=%22Mesut+Ozil%22",
"query": "%22Mesut+Ozil%22",
"tweet_volume": 17195,
"name": "Mesut Ozil",
"promoted_content": null
},
"locations": [
{
"woeid": 23424863,
"name": "Kenya"
}
]
}
]
The tweet_volume value is brand new addition to the API. You can learn about it on the Twitter Developer forums:
Additionally, we are also now returning a tweet_volume for each trend
- this is the volume of tweets per trend for the last 24 hours.
I believe that this is across the site rather than per WOEID but ICBW.

How Do You Find Someone's Facebook ProfileID?

I am working on an iOS app that loads peoples' profile pictures into an instance of FBProfilePictureView, which has a property of profileID. Is there a way to easily find someone's profileID?
I'm conflicted as to whether this should be in the comments or an answer, but here's how:
You use the Open Graph API found here
A call of http://graph.facebook.com/username returns you a bunch of Json which you can get the id value from.
So, http://graph.facebook.com/facebook returns:
{
"id": "20531316728",
"about": "The Facebook Page celebrates how our friends inspire us, support us, and help us discover the world when we connect.",
"can_post": false,
"category": "Product/service",
"checkins": 348,
"cover": {
"cover_id": "10152513030211729",
"offset_x": 0,
"offset_y": 62,
"source": "https://scontent-b.xx.fbcdn.net/hphotos-xfp1/t31.0-8/q71/s720x720/1553497_10152513030211729_1664524928_o.jpg"
},
"founded": "February 4, 2004",
"has_added_app": false,
"is_community_page": false,
"is_published": true,
"likes": 152791404,
"link": "https://www.facebook.com/facebook",
"mission": "Founded in 2004, Facebook\u2019s mission is to give people the power to share and make the world more open and connected. People use Facebook to stay connected with friends and family, to discover what\u2019s going on in the world, and to share and express what matters to them.",
"name": "Facebook",
"parking": {
"lot": 0,
"street": 0,
"valet": 0
},
"talking_about_count": 2149385,
"username": "facebook",
"website": "http://www.facebook.com",
"were_here_count": 0
}
Why not using the Facebook Tool ? You can have ID and some other information (In JSon format) about people with only replacing their username in the URL.

Limiting Twitter API results to tweets sent to all users (no #replies)?

I'm trying to find a way to just get tweets to all users. The JSON code indicates these as "to_user" null. For example the tweet below edent tweets to everyone, thus the to_user=null.
I tried a few alternatives without success:
http://search.twitter.com/search.json?q=to:null%20from:edent&result_type=mixed
http://search.twitter.com/search.json?q=to:0%20from:edent&result_type=mixed
http://search.twitter.com/search.json?q=to:%20from:edent&result_type=mixed
{
"created_at": "Thu, 28 Jun 2012 06:55:58 +0000",
"from_user": "edent",
"from_user_id": 14054507,
"from_user_id_str": "14054507",
"from_user_name": "Terence Eden",
"geo": null,
"id": 218236278402068480,
"id_str": "218236278402068480",
"iso_language_code": "en",
"metadata": {
"result_type": "recent"
},
"profile_image_url": "http://a0.twimg.com/profile_images/2318692719/7182974111_ec8e1fb46f_s_normal.jpg",
"profile_image_url_https": "https://si0.twimg.com/profile_images/2318692719/7182974111_ec8e1fb46f_s_normal.jpg",
"source": "<a href="http://twitter.com/">web</a>",
"text": "RT #straczynski: #edent Clearly the man was ahead of his time.",
"to_user": null,
"to_user_id": 0,
"to_user_id_str": "0",
"to_user_name": null,
"in_reply_to_status_id": 218075066452287500,
"in_reply_to_status_id_str": "218075066452287488"
},
If you're just looking to get tweets from a particular user that aren't to anyone, use the /get/statuses/user_timeline REST API endpoint instead of the Search API. /get/statuses/user_timeline has an exclude_replies parameter that should do what you're looking for.
The Search API doesn't have any way to exclude replies. Your only option is to get tweets matching whatever other parameters you pass, and process them on your end to remove any whose text starts with "#".

Resources