buzz follower using yql - yql

HI
how can i grab buzz follower using YQL . actually i want to count the total no of buzz follower . please help

You would need to obtain an OAuth access token for Google Buzz first because the access points for obtaining followers require authentication. Then, instead of the usual methods of passing in an OAuth signature to the Buzz API, you would do it through the URI with query parameters. This will allow you to craft the URI and pass it through to YQL, which will in turn relay it to the Buzz API. You will, of course, need to generate your YQL query dynamically. Then you can make the API call to get the list of Buzz followers.
Please note, OAuth is hard, and this is probably very nearly the hardest possible usage of OAuth I can think of. Not for the feint of heart. In this case, YQL is going to make things much more complicated, not less complicated.

Related

Microsoft Graph: Pagination in 'Get Organization' api

I am trying to use 'Get /organization' api to fetch the tenant name, tenant id and list of domains in the tenant. If there are many domains (say 300-400) in the tenant, would all of them be included in the response? or would the response be paginated? In that case how should I handle pagination?
My app is Java based and I am directly using the REST interfaces.
Are you seeing issues getting all the data back? AFAIK Organization is a singleton, so specifying $top won't help here. My assumption is that you will get all the data back in the single response.
Hope this helps,

Building a bot, can't use any queries starting with /me/

Ran into a roadblock when trying to implement people search (using names or whatever else) from an app-only authenticated bot. Is there a way for the bot to query the graph without it having an identity? I can do this:
GET "https://microsoft.graph.com/beta/users/" + userPrincipalName + "#hooli.com"
But I can't do this:
GET "https://microsoft.graph.com/beta/me/people/?$search=" + "\"" + query + "\""
It makes sense, the bot isn't a user object. I just wanted to see if you had any suggestions for this scenario. (The idea is for this bot to be published to SharePoint, and eventually to SfB when that becomes a real option.)
Very cool that you are connecting to Microsoft Graph with a bot scenario! Couple of things here. Firstly the /me construct requires that a user is signed in, as /me is an alias for the currently signed-in user. App-only will not work with this request, as you have discovered. You've also discovered that you can do a more rudimentary search only through the users entity. You can do something a bit smarter here by using a startswith search together with an "or" conjunctive clause (see below). However $search is not currently supported for the users entity.
GET https://graph.microsoft.com/v1.0/users?$filter=startswith(displayName,'xxx') or startswith(mail, 'xxx') or startswith(userPrincipalName, 'xxx')
Secondly the people entity is a search that is done from the point of view of the signed-in user. It can't currently be done by app-only (people is only supported under me). Will need to get others to provide some info on whether a generic people search will be supported through this API. Also people is still in preview.
Please let us know if the suggested workaround (using startswith) is adequate for now, and can be replaced later once there is a more powerful $search support.
One other thing - if the user is interacting with the bot (say through a web site or a mobile client) - could the user be signed in already, and the bot use the on behalf of flow to call into MS Graph from your bot as the user?
Hope this helps,

MVC4 Get user Tweets, alternative to v1 (deprecated)

Using MVC4, I would like to get the recent Tweets (3) of user's without having to request access from them, because that is a pain for the user. This is also because a user may be viewing another user and I would also like to display their Tweets.
This was fairly simple with Twitter API v1:
$.ajax({
url: 'https://api.twitter.com/1/statuses/user_timeline.json?count=3&screen_name=' + twitterUser,
...
});
..but its deprecated and will stop working in about two months from now.
I'm new to Oauth and have struggled to find any good material on how to get a user's Tweets, but I believe the process is a lot more complicated now with the Twitter API v1.1? Ideally, I'd like to achieve everthing in the front end, but think that I now need to do some authentication server side and will have to use MVC?
In order to get any user's Tweets, I was thinking that I could create a Twitter account for my application and use that to get anyone's Tweets, as long as they are not protected.
Does anyone know of any good libraries that I can use to achieve this, or is the out of the box MVC4 Oauth stuff alone enough to do the job?
Any suggestions of where to start, and especially examples would be greatly appreciated.
To use API 1.1, you have to have a Twitter account and a Twitter application and then use OAUTH to authenticate your rate limited requests using GET statuses/show/:id. The only alternative I know is RSS which both Twitter & Facebook have kiiled, briught back and threatened to kill again:
http://api.twitter.com/1/statuses/user_timeline.rss?screen_name={USERNAME}
I decided to use Linq2Twitter, as this makes use of the V1.1 API.
An MVCDemo example of Linq2Twitter stores the authorised credentials in a SessionStateCredentials object, but I can store the object in cache and persist the authorisation for all users, meaning they won't have to authorise anything. Provided that a user's Tweets aren't protected, the Tweet's for any user should be retrievable this way.

Does Omniauth-google-oauth2 simply allow authentication, or does it also address API needs?

I'm having trouble understanding OAuth2 conceptually. I've read about the whole handshake process a hundred times. I can login to my app using a google account, but once that's done, I need to access Google's API (read data from a Google Spreadsheet on that same account that I logged into, and whom I included spreadsheets in the :scope as per the strategy readme).
Currently, I'm using Omniauth and the omniauth-google-oauth2 strategy; this works great; it pulls up Google's authentication/login screen, and when I get back to my callback link, I'm storing [omniauth][credentials][token].
What is the best way to then use that token to do API work with Google Docs?
Is this the right approach?
I think of Oauth2 as a "way to get the user's password to confirm their existence on my site".
So instead of your User model having a password column, in essence, it uses Google to say "this guy is cool".
Now, what does that have to do with API calls, you wonder... me too.
If I recall, there is a Refresh token that lasts for more than the 20 ms of authetication and will allow you to access their Google Docs, if Google's api allows you to do that.
Having said all that, If google needs their token, plus your API token to access their spreadsheet, I'd stick it into the session.
But if their API said to stick spreadsheet in the scope, then it must say something about how to use it all together too, no?
More Edits
Google Spreadsheets Oauth 2.0 authentication piece is here, with a flow. Notice the part about refresh tokens. I'd look into that.
It says to store it somewhere, which I'd choose the session, or if you are totally paranoid a db column somewhere, but not sure if that is right either. Just spitballing here.
Final Edit
Turns out even the people helping out the Oauth 2.0 don't agree/get it conceptually either.
You may be able to find a gem that wraps the Google API to simplify your tasks.
Here's one that works with Google Drive and spreadsheets.
The google-drive-ruby gem that #Galen mentions seems to work nicely with the google-oauth-2 provider:
Guessing you're already storing the token in the session in your callback handler, e.g.
auth = request.env["omniauth.auth"]
session[:token] = auth["credentials"]["token"]
then you can use it to build a session and access the sheet:
require 'googleauth'
session = GoogleDrive::Session.from_access_token(token)
worksheet = session.spreadsheet_by_key(spreadsheet_id).worksheet_by_title(worksheet_name)
...etc
Hope this helps.

Read twitter user timeline without oauth but with rate limiting on my application

Basically what I'd like to do is request a users public timeline (including retweets) without having to use authentication, but with rate limiting applied to my application and not the IP.
I want to run this request (for several different screen names):
http://api.twitter.com/1/statuses/user_timeline.json?screen_name=stephenfry&include_rts=1&trim_user=1
against the API, but I'm behind a proxy/firewall that basically causes thousands of users to share the same IP which means that my ip is almost always rate limited. Is it possible to insert my API key into the request somehow (header, part of the query string) and have rate limiting on it and not the ip?
I really don't want to go through the full OAuth authentication mechanism for each user as this would require their interaction and I only wish to read their public feed.
I have implemented local caching for the tweets so it will at most make 4 requests per hour/username, but this does me little good when the ip is rate limited from the start.
Can this be done and if so how would I do it?
Edit: I should add that using the Search API is not possible as it will not return any tweets for some of the users (tweets are too old).
There is no form of application-only identity on the Twitter API. To make an authenticated request, you must have a user context. If your integration is purely server-side, you could utilize a single access token representing your own account and make signed, authenticated requests that way. I would not recommend any kind of hard coded tokens in a client-side or distributed environment. You may want to take a look at what's possible using the Streaming API and it's follow filter -- allowing you to stream public tweets by specific users in real time.

Resources