Getting events that a certain profile is attending - events

Im trying t get some info for some events that certain profile rsvp status is attending but it retrieves blank. Maybe is something about access tolken or whatever.
This is my current fql
SELECT name, pic, start_time, end_time, location, description
FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = 100003454558689 AND rsvp_status = 'attending')
ORDER BY start_time asc
But it retrieves blank. How can I fix it?

Well your code is good, you just have to make sure you have the user's rights to get that data. So go to the facebook graph explorer, and pop in your code, but this time change the UID to me(). Why does that work?
Your access token, granted by the Facebook app, determines what user data you can see on Facebook. The Graph Explorer by default shows you your own data.
So make sure that you have the right permissions for event data. You can test it by the Acess Token drop down on the Graph explorer.
Here is a list of permissions: https://developers.facebook.com/docs/authentication/permissions/
Looks like you need "user_events"
So it might be nothing wrong with FQL, but something in the auth process. Good luck.

Related

what is wrong with my query, it is not being saved?

I am migrating an app from old apex to the new version. some of my pages are not saving the new changes that I am making. for example this is my query for a page item from the old apex environment:
select DESCRIPTION display_value, DESCRIPTION return_value
from AUC_AUCTION_TB
where admin_emailaddress =
(select email
from SYSTEM_USERNAME_TB
where username = :APP_USER) or :APP_USER in ('SESH','PETS','ROPO','JEMU','HESH')
order by START_DATE desc
So I want to make some changes to the query in the new environment, because the new environment is using a different table. My new query is:
select DESCRIPTION display_value, DESCRIPTION return_value
from AUC_AUCTION_TB
where admin_emailaddress =
(select EMAIL
from ALL_USERS
where USERNAME = :APP_USER) or
:APP_USER in ('SESH','tshithigonap','poolmar','muhulumaj','shipaleh')
order by START_DATE desc
The problem is when I make this changes the page is not being saved with the new changes, I keep getting this pop up:
There are unsaved changes. Press Ok to discard your changes or Cancel to return to the current page.
So when I go to a different page and then come back to my page, I notice non of my changes have been saved, even though I clicked the save button. Is something wrong with my query perhaps or why is this happening, I have many pages with this issue, please help.
It doesn't have to be that query (it looks OK); there's something else that is wrong on that page. What? Check errors, here:
That's a dummy error I just produced, just to illustrate the issue; you'll get some other message. Then click on each of those messages - Apex will take you to that very spot.
If the query in your example gets executed correctly in a separate worksheet, there's probably an issue in passing the bind variables or setting the correct type of region.
Maybe try using v('APP_USER') instead of :APP_USER.
So my changes were not being saved because I did not have permission, so one of the admins in the app changed my permission from Developer to administrator, so I logged out and logged in again with administrative rights. So this allowed me to change changes for a while and later I experienced the same problem again, but this time all I had to do was change the browser from chrome to Firefox, now everything is working perfectly, thanks a lot!

Facebook graph api Events and Venue Information, sometimes it only returns venue id when the event was created in a known venue

I'm creating an app in Titanium that uses the Facebook Graph API to get all the users events, however, the venue information, it only brought to me, after I was very specific about the field, and some times, a lot of the times, when the Event was created in a known location, it only brings the venue_id, and when I query the venue(via http://graph.facebook.com), then it gives me the venue location details, more importantly, the latitude and longitude of the thing.
Is it possible to bring the information of the venue in the same response?
Also, it only brings the events that the user is attending, is there any way to show the events recommended to him also?
Ti.Facebook.requestWithGraphPath('me/events?limit=5000&fields=id,owner,name,description,start_time,end_time,location,venue,privacy,updated_time', {}, 'GET', function(e) {
obj = JSON.parse(e.result);
Ti.API.info('Events: '+JSON.stringify(obj));
}}); // Facebook Events
Also, it only brings the events that the user is attending, is there any way to show the events recommended to him also?
Not sure what exactly you mean by “recommended” … if you mean events the user has been invited to, then you can query the FQL event_member table with the user id.
You can kind of “join” the info from the table above with the event table by selecting from that using WHERE eid IN (SELECT … FROM event_member WHERE …)
Is it possible to bring the information of the venue in the same response?
Using a multi-query you can do it, similar to as it is described here: FQL: query for event table returns venue.name instead of venue.id

Querying for past events using FQL

I'm trying to access the past events of a given user. I'm using the following FQL query: SELECT eid, name, pic_square, start_time, end_time, location FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = me() AND rsvp_status != 'declined') AND start_time < 1338974650 ORDER BY start_time DESC LIMIT 0,20 (1338974650 is supposed to be the current UNIX timestamp). This works fine. However, facebook only returns a set of 4 events in my case, whereas facebook.com displays a lot more. Why is that?
Yes. Facebook severely limits the amount of past items returned by an API call. When I visit one of my pages, I see over 75 events listed on the past events page. When I query the page's events using either FQL or Graph API, I only get 2 events. My guess is Facebook has a separate table that stores past events that isn't available via the API.
BTW, You can make your code simpler by replacing your timestamp with now().
if you query the event_member table by passing the uid, you will get all the events that were CREATED by the user. if you query the table by passing one eid, it gives you the members of the event and their rsvp statuses.
EDIT: try setting start_date > 0 as stated here it should show you ALL the events.

MVC3 User Authentication link

In my application I have an administrator who can create Tournament objects. When the object is created the service also creates a user (based on the tournament director's info which was entered at creation). The username for the user is the director's e-mail, the password is randomly generated and then mailed to the director.
When the director logs on with his e-mail address and password, I need to be able to link him to his own tournament, in order to only allow him to edit his own tournament's details. I have tried to find a way to store the TournamentId in the default ASP Net Users database, but was unsuccessful.
I had a look at this SO question which would certainly help me, but I can't figure out how it would apply to my problem. When the user logs on, I can't put the TournamentId in the userdata seeing as I don't know it.
Should I then do a lookup in the Tournament table to see which ID corresponds to the email address entered at login and store that in the userData? It seems quite unelegant this way.
I guess you should have a CreatedBy column in your Tournament table where you store the ID of the user who created the tournament. Then when the user logged in, get his id ( may be from session ,if you store it there), Do a select query where CreatedBy=loggedInUserId .That should do the trick.

Facebook API get events CREATED BY friends

I am developing facebook app which needs to retrieve events created by some of my friends.
Standard SQL query would look like this:
NSString *fql1 = #"SELECT "
#"eid, name, tagline, id, pic_small,host, description, start_time, creator "
#"FROM "
#"event "
#"WHERE "
#"creator = 1111111111 OR creator = 2222222222 OR creator = 333333333";
Facebook allows only to filter tables by indexed fields (which is eid in this table). I assume I could to construct multiquery. Anyone could help with it? I spent some time googling it with no look. I need only one query so learning whole fbl for this has no sense for me at the moment.
BTW: there is a function events.get - you can filter by uid (documentation says):
parameter: uid - Filters by events associated with a
user with this uid.
ASSOCIATED In what sense? are those creator's uids?, invited, attending or maybe? Why facebook documentation is so frustrating?
When I try events.get with uid parameter it returns result with different creators ids than uid parameter.
Graph API function: uid/events returns events user has been invited to, attended or other status but NOT necessarily created by him.
What am I missing here? I granted necessary permissions to my application, it connects, gets friend's event lists but not the events I want.
Seems so simple but I con not find straight-forward solution.
I'd appreciate any help.
You can do something like this:
SELECT
eid, name, tagline, pic_small,host, description, start_time, creator
FROM
event
WHERE
eid IN (
SELECT
eid
FROM
event_member
WHERE
uid=111 OR uid=222) AND
(creator=111 OR creator=222)
Basically this says get the events user 111 or 222 is a member of and of those, only return the ones they've created. Because eid is an indexable field, FQL is okay with this, and is happy to do the additional (creator=111) trimming for you.

Resources