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

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 "#".

Related

How to use twilio rest api with loadrunner?

I am currently doing POC(proof of concept) on IVR loadtesting where I just want to call a IVR and have no interest in sound quality and all. So I come across twilio rest api which can make a outbound call.
It is working perfectly with python but I want to use it with loadrunner as it support rest api. I searched for twilio api urls and key value combinations. but hard luck for this. can anyone provide me the required URL and key value arrangement. or can guide me how to get those.
thanks in advance.
The documentation, Making Calls, has some code examples and example responses. You can make an API call using Postman (POST via x-www-form-urlencoded) and see the key:value pairs in the returned JSON, as shown below. API Explorer in Twilio Console is also useful for that.
{
"date_updated": null,
"price_unit": "USD",
"parent_call_sid": null,
"caller_name": null,
"duration": null,
"from": "+15095550100",
"to": "+14075550100",
"annotation": null,
"answered_by": null,
"sid": "CAaacc78574ae1b9d2bf483f0123456789",
"queue_time": "0",
"price": null,
"api_version": "2010-04-01",
"status": "queued",
"direction": "outbound-api",
"start_time": null,
"date_created": null,
"from_formatted": "(509) 555-0100",
"group_sid": null,
"trunk_sid": null,
"forwarded_from": null,
"uri": "/2010-04-01/Accounts/ACdeca5d479509eeb8beaba0123456789/Calls/CAaacc78574ae1b9d2bf483f0123456789.json",
"account_sid": "ACdeca5d479509eeb8beaba0123456789",
"end_time": null,
"to_formatted": "(407) 555-0100",
"phone_number_sid": "PN0b9c2733e2a9ad0c98352b0123456789",
"subresource_uris": {
"notifications": "/2010-04-01/Accounts/ACdeca5d479509eeb8beaba0123456789/Calls/CAaacc78574ae1b9d2bf483f0123456789/Notifications.json",
"recordings": "/2010-04-01/Accounts/ACdeca5d479509eeb8beaba0123456789/Calls/CAaacc78574ae1b9d2bf483f0123456789/Recordings.json",
"feedback": "/2010-04-01/Accounts/ACdeca5d479509eeb8beaba0123456789/Calls/CAaacc78574ae1b9d2bf483f0123456789/Feedback.json",
"payments": "/2010-04-01/Accounts/ACdeca5d479509eeb8beaba0123456789/Calls/CAaacc78574ae1b9d2bf483f0123456789/Payments.json",
"feedback_summaries": "/2010-04-01/Accounts/ACdeca5d479509eeb8beaba0123456789/Calls/FeedbackSummary.json"
}}

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.....

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.

Search for tweets with t.co rewritten links

Just noticed a spike of visitors following a t.co/LINKHERE a link re-written by twitter. Is there a way to track back to the twitter message that contained the link, if you know the link?
You can do this using twitter API 1.1. The easiest way is to use the api is through the twitter API console. Here are the steps:
Goto https://dev.twitter.com/rest/tools/console
Select https://api.twitter.com/1.1 from the Service dropdown menu.
Select OAuth 1 from the Authentication dropdown menu and authorize with your twitter account.
Choose GET /search/tweets.json api.
Type the t.co link (e.g. https://t.co/w6iqrcuZMA) in q query parameter (Try both http and https links. In my case the http link returned no record while https link returned some records). All the search results will be returned in json format.
Now to open the actual tweet use this link (fill the placeholders of course): https://twitter.com/{user.screen_name}/status/{id_str}
The standard twitter search will work for a few days.
For older t.co links, you could try searching with
find-tco.appspot.com.
Here’s the quick and easy way:
Go to: http://dev.twitter.com/rest/tools/console
Service: “api.twitter.com/1.1”
Authentication: OAuth 1, then log in if you need to
Make sure GET is selected and paste https://api.twitter.com/1.1/search/tweets.json?q=http%3A%2F%2Ft.co%2F{**SUFFIX**} into the Request URL box.
Replace **SUFFIX** with the t.co URL suffix. So if the URL you’re searching for is t.co/**N2ul8FFCxu**, the link you pasted should look like this:
https://api.twitter.com/1.1/search/tweets.json?q=http%3A%2F%2Ft.co%2F{**N2ul8FFCxu**}
Click Send
Open a new tab and paste twitter.com/**SCREEN_NAME**/status/**ID_STR** into the address bar
Replace **SCREEN_NAME** and **ID_STR** with info from Response. Like this:
twitter.com/**twitter**/status/**526534593826938881**
t.co links do show up in search, so if you're curious, you have about a week to find them before they get dropped from the search index.
For example:
http://search.twitter.com/search.json?q=https:%2F%2Ft.co%2FGJMsIcM6
Returns:
{
"completed_in": 0.019,
"max_id": 178215431251828740,
"max_id_str": "178215431251828736",
"page": 1,
"query": "https%3A%2F%2Ft.co%2FGJMsIcM6",
"refresh_url": "?since_id=178215431251828736&q=https%3A%2F%2Ft.co%2FGJMsIcM6",
"results": [
{
"created_at": "Fri, 09 Mar 2012 20:27:24 +0000",
"from_user": "kurrik",
"from_user_id": 7588892,
"from_user_id_str": "7588892",
"from_user_name": "Arne Roomann-Kurrik",
"geo": null,
"id": 178215431251828740,
"id_str": "178215431251828736",
"iso_language_code": "en",
"metadata": {
"result_type": "recent"
},
"profile_image_url": "http://a0.twimg.com/profile_images/24229162/arne001_normal.jpg",
"profile_image_url_https": "https://si0.twimg.com/profile_images/24229162/arne001_normal.jpg",
"source": "<a href="http://twitter.com/tweetbutton" rel="nofollow">Tweet Button</a>",
"text": "RT #raffi: “Twitter Catches the 'SPDY' Train” from #wired → http://t.co/suCbWWEl (& they reference my tweet! → https://t.co/GJMsIcM6)",
"to_user": null,
"to_user_id": null,
"to_user_id_str": null,
"to_user_name": null
},
{
"created_at": "Fri, 09 Mar 2012 20:26:26 +0000",
"from_user": "raffi",
"from_user_id": 8285392,
"from_user_id_str": "8285392",
"from_user_name": "Raffi Krikorian",
"geo": null,
"id": 178215186921033730,
"id_str": "178215186921033730",
"iso_language_code": "en",
"metadata": {
"result_type": "recent"
},
"profile_image_url": "http://a0.twimg.com/profile_images/1270234259/raffi-headshot-casual_normal.png",
"profile_image_url_https": "https://si0.twimg.com/profile_images/1270234259/raffi-headshot-casual_normal.png",
"source": "<a href="http://twitter.com/tweetbutton" rel="nofollow">Tweet Button</a>",
"text": "“Twitter Catches the 'SPDY' Train” from #wired → http://t.co/suCbWWEl (& they reference my tweet! → https://t.co/GJMsIcM6)",
"to_user": null,
"to_user_id": null,
"to_user_id_str": null,
"to_user_name": null
}
],
"results_per_page": 15,
"since_id": 0,
"since_id_str": "0"
}
You'll see that search returns retweets as well.

Google Contacts API not showing emails, nor max results

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.

Resources