Public/Private Events When Querying Facebook Graph API - ruby-on-rails

I'm building an RoR application that uses the Facebook Graph API, scraping a users events via their user_access token. I'm essentially taking that user token and making a Graph call to the API, getting all the events the user has either given a rsvp, created, declined, maybe and not_replied response to the events they've been invited to. Here is my query...
GraphAPIEndPoint = [created, declined, maybe, not_replied]
GraphAPIEndPoint.each do|endpoint|
data = Koala::Facebook::API.new(access_token)
events = data.get_connections("me", "events/#{endpoint}", fields: ['id',"name","description","place","start_time","end_time","timezone","ticket_uri", "cover"])
end
This query gives me the desired data but I'm unsure whether I'm getting private events from the user, which I don't want. After I've received the data, I've checked some source url's in my browser, which show a Facebook default error page saying, "Sorry this page isn't available". Other Facebook url's I've tested show me their events as public events, only the ones that seem specific to a group of friends or family give me this default error page. Also, if the events were deleted by the author (which could be an answer as to why I'm getting the default error page), why am I still getting the JSON for the event?
My only assumption is that I am, and if so, what are the privacy parameters to prevent this from happening and give me only the public events?(Please no FQL suggestions)
Thanks for your help!

Related

How to get list of events via GRAPH API with LimitedDetails permissions?

I try to get a list of events via List calendarView
It works as expected when users have Reviewer permissions in the exchange server, but as soon as they have only LimitedDetails - I have an error "access denied".
I assume that the problem is that with LimitedDetails I can only get subjects (without event body).
How can I request the list of events (I need Subject, ICallId and IsAllDayEvent properties) in this case?
Limited Details is a FreeBusy permission so it should work in https://learn.microsoft.com/en-us/graph/api/calendar-getschedule?view=graph-rest-1.0&tabs=http as this queries the users freebusy time but it won't work when trying to query the calendar which requires reviewer or greater.

Microsoft Graph API SDK .NET Issues getting other users emails

I am using the Microsoft Graph SDK as downloaded from NuGet (1.2). I authenticate to Azure AD (using ADAL).
I am using Client Credentials flow (not authenticated as any particular user) and am using Application Permission roles to access resources.
We are going to set up one service mailbox with a bunch of aliases. The aliases are given to the clients. This is so they are emailing an address that has a meaningful name to them.
My app will run as a service, and routinely scan new emails in this inbox. It should find the To address, and depending on what alias was used, file the email in a location relevant to that client.
The resource I want is: GET /users/<id | userPrincipalName>/messages
However, there doesn't appear to be a method in the SDK for it.
I can get users with this:
IGraphServiceUsersCollectionPage filteredUsers =
graphApi.Users.Request()
.Filter("userPrincipalName eq 'user#domain.com'")
.GetAsync().Result;
When I loop through the collection, I can see that the User has a 'Messages' property, but it is always null.
If I manually build a request message with HttpClient I can get the messages.
The second problem is that the Recipient property is always the userPrincipalName of the mailbox. How can I get the alias that was used by the sender?
While you are able to get your collection of users successfully, you have to make another request to receive the messages. This would look something like:
IUserMessagesCollectionPage userMessages =
graphApi.Users["user_id"].Messages.Request()
.GetAsync().Result;
To answer your second question, at this time you cannot access the original recipient through the Graph API, but you can do this through EWS. This is due to the fact that you can only retrieve the SMTP message headers through EWS. You can read more about how to do this here.
If this is something you believe is valuable to you in the Graph, I would encourage you to post it in our UserVoice.
If you want to get the email as a file, you can simply get the body as bytes through the SDK:
byte[] asBytes = Encoding.Unicode.GetBytes(message.Body.ToString());

Instagram api not returning any followers although response code is 200

I am using instagram to recieve the list of people i follow and although api returns the status code 200 I recieve absolutely no data.I tried using postman client instead of my code and even from there no data is being returned I am hitting the following service.
https://api.instagram.com/v1/users/self/follows?access_token=token
one thing to be noted is my application is in sandbox mode and this same access token is working and fetching other information about the user including media shared by the user and its basic information etc and user follows and is followed by several users.
Please suggest the solution thanks in advance.
I may have answer to this question since I was facing the same issue on my WinRT project yesterday.
You may need the relationship scope instead of 'follower_list' scope.
I am assuming that you have provided the scope as 'follower_list' in the authorization URL and logged in as yourself or through your own Instagram account(the same account with which you have created your Instagram app). And now if you are hitting the above service it will return nothing in data since you are requesting if the user is following you or not(so obviously you are not following yourself)!! So if you try logging in with someone else's Instagram account and hit the above service with follower_list scope it will return your Instagram account in data if the logged in person is following you.
EDIT
The above service will return all the users that are following you AND present in your sandbox users list. (Or at least that is my conclusion on this)
For further clarification try https://apigee.com/console/instagram for hitting this service there they are using the relationship scope.

YouTube Api Explorer Usuage as ContentOwner: forbidden

I'd like to get the impressionBasedCpm from the Api Explorer ( and later from my app).
I can log in with an youtube partner account and toggle the oauth switch. I set all scopes to checked.
Then I try to enter
ids: contentOwner==NAME_OF_CONTENT_OWNER (not the id, retrieved from the content API, https://developers.google.com/youtube/partner/docs/v1/contentOwners/list#try-it)
metrics: impressionBasedCpm
start-date: '2015-05-01'
end-date: '2015-06-01'
The output still tells me:
You do not have permission to execute this method.
Can someone help me?
My guess is that when I authorize the application I seam to still login as a channel, so the query as a content owner is not allowed. I picked the main one with the email address. But when I'm on youtube I can switch to a specific Content-Manager Channel/Account.
Even when I try to just get the 'likes' for the contentOwner it doesn't work. If I try to get the likes based on the channel_id it works. But I like to get reports for a youtube partner that uses youtube's cms.
cheers
This query won't work because it does not follow the semantics of the API. You need to provide the ID of the contentOwner in order to get a 200 OK response. Name of Content Owner cannot be unique and hence would lead to erroneous results.

Eventbrite - Getting past events

I'm using eventbrite.com, and I'm trying use the rest API to get all the previous events for my user (organizer in eventbrite). I am expecting to get events that have occurred in the past.
I'm using the following url:
https://www.eventbrite.com/xml/event_search?organizer={MyOrganizerName}&app_key={MyAppKey}&date=past
However, I get nothing returned. ever. I am sure that have some events that happened in the past.
I am successfully getting events in the future. so there's nothing wrong with my client\app key\spelling\whatever.
With the newer Eventbrite APIv3 the endpoint changed to /users/me/owned_events The API comes with an API Explorer, which lets you see detailed debugging information for any endpoint just by going to it in a web browser.
Paste this url with your token id into your browser to get all past events:
https://www.eventbriteapi.com/v3/users/me/owned_events/?token=YOURTOKENID
The result is a paginated response of all the events your user account is organizing.
The event_search method is meant to return publicly available information about upcoming events only.
Try user_list_events instead:
https://www.eventbrite.com/xml/user_list_events?app_key={YOUR_APP_KEY}&user_key={YOUR_USER_KEY}&event_statuses=ended
You also have the option of creating an Organizer Profile Page, allowing you to group similar events together. The organizer_list_events API call may be useful for folks who are using that feature.

Resources