About getting a friendship network through the new Twitter api - twitter

Do you know whether it is possible to retrieve the "friendship" network in a group of Twitter users (where #X is considered to be friend of #Y when #X follows #Y) through the new Twitter api?
In other words, given two arbitrary Twitter users, do you know whether Twitter api replies to queries whether one of them follows the other one or not, when this query is made by some third party (using different authorization credentials from the ones of the former two users)?
If yes, how's is it done?

You can use Twitter REST API
The REST APIs provide programmatic access to read and write Twitter data. Author a new Tweet, read author profile and follower data, and more. The REST API identifies Twitter applications and users using OAuth; responses are available in JSON.
Specifically, you will need to use these two calls:
GET friends
Returns a cursored collection of user IDs for every user the specified user is following (otherwise known as their “friends”).
GET followers
Returns a cursored collection of user IDs for every user following the specified user.
There is not such a query exactly as you want, with input arguments #X and #Y, but with these two you should be fine.

Related

Get list of Google Business Reviews for any business?

Can I get a list of reviews from an arbitrary business?
It appears like you get a list of the reviews for a specific account and location.
https://mybusiness.googleapis.com/v3/accounts/account_name/locations/location_name/reviews
However, you can only get a list of account for an authenticated user.
https://mybusiness.googleapis.com/v3/accounts
Is there an endpoint or way to list out the reviews for any business? I just need the number or reviews, and really don't want to have to look at screen scraping type solutions.
The Places API returns only 5 for a business, GMB API requires the user as you’ve mentioned to authenticate; there’s no official endpoint for getting all listed reviews unless you either scrape the data; like Yelp, Google didn’t make it available to pull all user contributed content such as reviews; alternatively you can create your own DB for some businesses and manually update by pulling reviews off a third party site (eg: ReviewsMaker.com) where you can copy data to a table and keep track, but there’s no other real-time solution other than using the GMB API (which is restricted only to authenticated users)

Microsoft Graph API: admin can't list other users people

Logged in as the Office 365 Global Administrator, I want to get the relevant people list for any user in Active Directory.
I can get my calls to return using
https://graph.microsoft.com:443/v1.0/users('my.address#contoso.com')/people
and
https://graph.microsoft.com:443/v1.0/users/{the user id}/people
and
https://graph.microsoft.com:443/v1.0/users('{the user id}')/people
and
https://graph.microsoft.com:443/v1.0/users/my.address#contoso.com/people
but, as an Office 365 admin with People.Read.All consent in the app, the call only returns one person (the target user's profile) for any user but myself. If I call it for my user I get a list of ten people
If I log in as that other person and make the People List API call it returns the expected ten results.
JWT scope: "scp": "Files.ReadWrite Mail.Send People.Read.All User.Read
I have to change the scope to People.Read for the non-admin.
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_list_people
the call only returns one person (the target user's profile) for any
user but myself.
Answer is in the API Doc. As the document says.
Retrieve a collection of person objects ordered by their relevance to
the user, which is determined by the user's communication and
collaboration patterns and business relationships.
The following request gets the people most relevant to another person in the signed-in user's organization
https://graph.microsoft.com:443/v1.0/users('my.address#contoso.com')/people
It might happen that there is no one relevant to that user.
If you want the list of contacts in other user's contact list then you can refer to this one :
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_list_contacts
UPDATE
https://developer.microsoft.com/en-us/graph/graph-explorer
I used the demo account on this website. I used this query
https://graph.microsoft.com/v1.0/users/08fa38e4-cbfa-4488-94ed-c834da6539df/people It worked.
This query gives the same result
https://graph.microsoft.com/v1.0/users('08fa38e4-cbfa-4488-94ed-c834da6539df')/people
Same result
https://graph.microsoft.com/v1.0/users('MiriamG#M365x214355.onmicrosoft.com')/people/
Same result
https://graph.microsoft.com/v1.0/users/MiriamG#M365x214355.onmicrosoft.com/people/
If you still can't get it to work and specially on Graph Explorer Website. Then it means that according to Microsoft there are no relevant people for that particular user.
As you can see there are different ways to use the same thing. Try it all if it works. Let me know.
I am not seeing this behavior in the Graph Explorer sample tenant. The behavior seems to indicate that this is auth-related. I would try to sign in with the admin again and make sure that you've consented to any of the admin-only scopes. Additionally, one thing you can do to figure out whether you have the appropriate scope in your token is decoding the JWT and examining the "scp" collection.

Best way to find determine friendship of users (FacebookSDK)

I'm working on an iOS app which at one point displays a feed of information items to the user, that contain information about other users. These feed items are stored on a server that I run as well. I want to add a functionality that allows this user to filter the information and display only items of his facebook friends. It seems to me that there are three ways to achieve this
1
Client fetches all items.For each item run that FB SDK query /user-id/friends to determine friendship
2
Save all of the facebook ID's of the users friends on the client (each set time),and after fetching all items, determine if item is posted by friend with comparison to local database of friends.
3
The server with the feed items would run the query in the backend, and filter the content it provides to the client
Each of these has it's weakness and advantages, but I'd like to hear which is the preferred and "best" overall. I'm trying to achieve something like VENMO's home feed functionality if that makes sense.
Thanks for the help!

Can I use the Twitter gem to pull Twitter .user data from multiple Twitter names at the same time?

Ok. I've got a Ruby on Rails application and have successfully gotten authentication (thanks to other responses here). I can get it to tweet, read from the timeline, pull followers of the authenticated user, etc.
However, now what I'm looking to do is pull the follower lists of the authenticated user, determine which (if any) of those accounts is verified or not and then display the verified accounts. I can pull the nickname of each follower, however, it seems like I have to do each call individually (.user(ID#1) then .user(ID#2) then etc.) which results in me hitting the rate limit cap.
Therefore, what I'm looking for is a way to pass multiple IDs and return the user information for each ID in one call (or at least fewer than a 1 ID: 1 API call). I feel like this has to be possible (in fac
Yup, just do:
Twitter.users(id1, id2, id3)
Docs: http://rdoc.info/github/jnunemaker/twitter/Twitter/Client#users-instance_method

If I call Twitter API to get all of my followers, how many calls to the API is that?

If I want to download a list of all of my followers by calling the twitter API, how many calls is it? Is it one call or is it the number of followers I have?
Thanks!
Sriram
If you just need the IDs of your followers, you can specify:
http://api.twitter.com/1/followers/ids.json?screen_name=yourScreenName&cursor=-1
The documentation for this call is here. This call will return up to 5,000 follower IDs per call, and you'll have to keep track of the cursor value on each call. If you have less than 5,000 followers, you can omit the cursor parameter.
If, however, you need to get the full details for all your followers, you will need to make some additional API calls.
I recommend using statuses/followers to fetch the follower profiles since you can request up to 100 profiles per API call.
When using statuses/followers, you just specify which user's followers you wish to fetch. The results are returned in the order that the followers followed the specified user. This method does not require authentication, however it does use a cursor, so you'll need manage the cursor ID for each call. Here's an example:
http://api.twitter.com/1/statuses/followers.json?screen_name=yourScreenName&cursor=-1
Alternatively, you can user users/lookup to fetch the follower profiles by specifying a comma-separated list of user IDs. You must authenticate in order to make this request, but you can fetch any user profiles you want -- not just those that are following the specified user. An example call would be:
http://api.twitter.com/1/users/lookup.json?user_id=123123,5235235,456243,4534563
So, if you had 2,000 followers, you would use just one call to obtain all of your follower IDs via followers/ids, if that was all you needed. If you needed the full profiles, you would burn 20 calls using statuses/followers, and you would use 21 calls when alternatively using users/lookup due to the additional call to followers/ids necessary to fetch the IDs.
Note that for all Twitter API calls, I recommend using JSON since it is a much more lightweight document format than XML. You will typically transfer only about 1/3 to 1/2 as much data over the wire, and I find that (in my experience) Twitter times-out less often when serving JSON.
http://dev.twitter.com/doc/get/followers/ids
Reading this, it looks like it should only be 1 call since you're just pulling back an xml or json page. Unless you have more than 5000 followers, in which case you would have to make a call for each page of the paginated values.

Resources