Question

I'm trying to fetch the users news stream and get the names of the profiles from the actor ids of the news stream posts.

This is the query I use

NSString *fqlString = @"{"
@"'query0':'SELECT post_id, actor_id, message, created_time FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0 ORDER BY created_time DESC LIMIT 5',"
@"'query1':'SELECT id, name, pic_square FROM profile WHERE id IN (SELECT uid2 FROM #query0)',"
@"}";

This returns an OAuth Exception which says: "(#601) Parser error: unexpected '{' at position 0."

In fact it doesn't make sense because query0 and query1 are working both as single query.

Can anybody help me with that problem.

Was it helpful?

Solution

You have:

  1. A synthax error: type='newsfeed' must be type="newsfeed", because your query already starts after an apostrophe '.
  2. uid2 can't be found into #query0, because the field uid2 does not exist into the stream table. You most probably need the actor_id instead.

Here is your FQL query corrected:

{
 'query0':'SELECT post_id, actor_id, message, created_time FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type="newsfeed") AND is_hidden = 0 ORDER BY created_time DESC LIMIT 5',
 'query1':'SELECT id, name, pic_square FROM profile WHERE id IN (SELECT actor_id FROM #query0)'
}

Try it here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top