Facebook Graph API - get page feed + full event info? - javascript

Is it possible to, in 1 request, get the feed of a page but with the full event info?
As it is now, if a shared event is posted, you only get back the link to that event, no picture or title:
{
"id": "xxx",
"from": {
"category": "Community",
"name": "xxx",
"id": "xxx"
},
"story": "xxx shared xxx's event.",
"link": "https://www.facebook.com/events/xxx/",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/xxx/posts/xxx"
},
{
"name": "Like",
"link": "https://www.facebook.com/xxx/posts/xxx"
}
],
"privacy": {
"value": ""
},
"type": "link",
"status_type": "shared_story",
"application": {
"name": "Links",
"id": "xxx"
},
"created_time": "2013-06-19T10:05:50+0000",
"updated_time": "2013-06-19T10:05:50+0000",
"likes": {
"data": [
{
"name": "xxx",
"id": "xxx"
}
],
"count": 1
}
}

If I understand correctly, you need to retrieve the events but you want to do it all at once with the feed because you want to retrieve the information on the feed anyway.
Before doing that, you must know that the feed doesn't contain all the events.... Once created, a link to the event is automatically shared on the page feed. It is only a reference, which can then be hidden. The event won't be displayed on the feed anymore even if it still exists.
Requesting two different objects at the same time
So, the feed doesn't have the events information and the events and posts (feed) are stored on 2 different tables. Therefore, you need to get the events independently from the feed:
The feed /PAGE_ID/feed
The events /PAGE_ID/events
And, as you wanted, Graph API allows you to do this in only one request:
/PAGE_ID?fields=feed,events
Additional fields
Note that either feed or events accept the limit and fields parameters. For example, events can be specified by:
events.limit(100).fields(location,name,owner,description,updated_time,venue)
Possible fields are given in the doc.
There is no way to get the "full info" at once. You will have to specify each field in the request. So, don't get the "full info", but just the information you really need.

There is a post from Facebook addressing this scenario using multi-queries and FQL (Facebook Query Language). This will allow you to make multiple FQL calls in one request.
https://developers.facebook.com/docs/technical-guides/fql/#multi

Related

Socrata map results in $http request, Javascript

I am trying to use this dataset to determine which district boundary an address (passed into the API call) falls within.
The endpoint returns an array of objects for each district or council. The polygon is found within the "the_geom" property, with 2 properties - type and coordinates. I have tried using $where, but I get errors.
[
{
"comments": "Inaugurated 2015-06-22",
"council": "1",
"councilper": "Scott Griggs",
"district": "1",
"objectid": "1",
"shape_area": "343352603.892",
"shape_leng": "88541.3042539",
"the_geom": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
-96.80995700065864,
32.77138899977414
],
[
-96.80969800043205,
32.77121999997131
],
[ ...
I tried to use the query below, but it gave me an error:
https://www.dallasopendata.com/resource/h9ws-fqcn.json?$where=within_polygon(the_geom, 'MULTIPOLYGON (((-96.800270, 32.779091)))')
This is the page reference page - https://www.dallasopendata.com/Geography-Boundaries/Adopted-Council-Districts/6dcw-hhpj
And this is the endpoint- https://www.dallasopendata.com/resource/dgxr-hmze.json
any help would be greatly appreciated.
I suspect you're the developer who popped into our IRC channel, but I'll answer here too!
You're pretty close here! What you want to do here is use the intersects(...) SoQL function with a Well Known Text (WKT) POINT.
Here's an example that works for your use case:
https://www.dallasopendata.com/resource/h9ws-fqcn.json?$where=intersects(the_geom,%20%27POINT%20(-96.7994007%2032.775765)%27)

Find all parents elements in a Json file using jQuery

I'm currently working on a recursive menu which is built on top of jQuery which looks quite good already.
The structure of the JSon file containing the menu looks as the following:
[
{
"Id": "menuOfficeWebControlsForWebApplication",
"Title": "Office Web Controls",
"Resource": "/Documentation/Data/index.html" },
{
"Id": "menuGettingStarted",
"Title": "Getting Started",
"Resource": "/Documentation/Data/getting-started.html",
"Categories": [{
"Id": "menuCompilingFromSource",
"Title": "Compiling From Source",
"Resource": "/Documentation/Data/Getting-Started/compiling-from-source.html"
},{
"Id": "menuDownloadReleasePackage",
"Title": "Download Release Package",
"Resource": "/Documentation/Data/Getting-Started/downloading-release-package.html"
},{
"Id": "menuBuildingYourFirstApplication",
"Title": "Building your first application",
"Resource": "/Documentation/Data/Getting-Started/building-your-first-application.html"
}]
}
]
Now, I can retrieve an item out of the menu using jQuery and the result might be this item:
{
"Id": "menuBuildingYourFirstApplication",
"Title": "Building your first application",
"Resource": "/Documentation/Data/Getting-Started/building-your-first-application.html"
}
Now, I want to retrieve all the elements which are at a higher level and all the items which are directly below that item.
Any help is highly appreciated.
JQuery is for querying HTML elements from within the DOM of the current document, not for traversing objects or JSON expression strings.
In any case, given an object, there is no way to "discover" any objects, variables, or arrays that might hold a reference to it.
I'd recommend picking up a decent Javascript book and becoming familiar with the basics. Maybe stay away from things like JQuery at first as they can confuse things for you.

Firebase linking users across application with unique identifier

I'm using firebase and my users are set up like this:
{
"firebase-account-123": {
"users": {
"simplelogin:1": {
"properties"{ "name": "john doe", "email": "user#email.com" }
"children": {
"simplelogin:2":{ "name": "user 2", "email": "user2#email.com" },
}
},
"simplelogin:2": {
"properties"{ "name": "user 2", "email": "user2#email.com", "disabled": false }
}
}
}
I use simplelogin:X and the users email across many objects in my database. I know using this to identify my users across different objects is probably a bad move.
At some point I am trying to implement the ability to change emails which means that their simplelogin ID is going to have to change along with every email property that ever linked to their email.
Does anyone have any suggestions on how I can link users to one another without have to change their data if it changes across the entire platform? I'm thinking somewhere along the lines of a unique identifier for each users. I just don't know how I would implement this.

how to store data in local browser & retrieve back from it

i have json data below, i want to store those data in my browser & finally i want to get back those data from my browser if user request it from a textbox. How to do this stuffs?
Actually, i am a server side programmer, this is my second javascript/jquery demo example. I am basically trying to learn these stuffs with the help of creating demo. Please help me to learn.
i have jason data obtained by calling remote websites(eg. www.google.com/finance/....)
{
"list": {
"meta": {
"type": "resource-list",
"start": 0,
"count": 168
},
"resources": [{
"resource": {
"classname": "Quote",
"fields": {
"name": "USD/KRW",
"price": "1062.280029",
"symbol": "KRW=X",
"ts": "1396294510",
"type": "currency",
"utctime": "2014-03-31T19:35:10+0000",
"volume": "0"
}
}
}, {
"resource": {
"classname": "Quote",
"fields": {
"name": "SILVER 1 OZ 999 NY",
"price": "0.050674",
"symbol": "XAG=X",
"ts": "1396287757",
"type": "currency",
"utctime": "2014-03-31T17:42:37+0000",
"volume": "217"
}
}
}
]
}
}
Using jQuery and Localstorage you could do:
Set item:
localStorage.setItem('myJSON',yourJSONString);
Remove item:
localStorage.removeItem('myJSON');
Get item:
var JSONString = localStorage.getItem('myJSON');
There are several types of browser storage such as localStorage they are all built in and can be used directly.
Storage objects are a recent addition to the standard. As such they may not be present in all browsers.........The maximum size of data that can be saved is severely restricted by the use of cookies.
Code sample:
function storeMyContact(id) {
var fullname = document.getElementById('fullname').innerHTML;
var phone = document.getElementById('phone').innerHTML;
var email = document.getElementById('email').innerHTML;
localStorage.setItem('mcFull',fullname);
localStorage.setItem('mcPhone',phone);
localStorage.setItem('mcEmail',email);
}
On the other hand, localStorage might not be enough, therefore, external libraries come to hand which actually utilize the browsers built in storage and make the db works cross browsers.
1- SQL like DB sequelsphere (looks like suitable for heavy lifting!)
Code sample for query that will run directly from the browser:
SELECT empl_id, name, age
FROM empl
WHERE age < 30
2- JSON like DB taffydb (looks like suitable for every day activity!)
// Create DB and fill it with records
var friends = TAFFY([
{"id":1,"gender":"M","first":"John","last":"Smith","city":"Seattle, WA","status":"Active"},
{"id":2,"gender":"F","first":"Kelly","last":"Ruth","city":"Dallas, TX","status":"Active"},
{"id":3,"gender":"M","first":"Jeff","last":"Stevenson","city":"Washington, D.C.","status":"Active"},
{"id":4,"gender":"F","first":"Jennifer","last":"Gill","city":"Seattle, WA","status":"Active"}
]);
// Find all the friends in Seattle
friends({city:"Seattle, WA"});
3- jstorage is a cross-browser key-value store database to store data locally in the browser - jStorage supports all major browsers, both in desktop (yes - even Internet Explorer 6) and in mobile.
If you would like to have more options ->(client-side-browser-database)

facebook graph api picture

How can I retrieve friends picture using graph api.
I have manage to get my friends profile picture using this
https://graph.facebook.com/{user_id}
But, I want to get the photos my friend has posted.
I am able to get this data
"link": "http://www.facebook.com/photo.php?fbid=121312&set=a.23342344855.11344514&type=1",
"name": "~KAALAM moments :)",
"caption": "51 new photos",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/1140004514/posts/12234"
},
{
"name": "Like",
"link": "http://www.facebook.com/1140004514/posts/12234"
}
],
"type": "photo",
"object_id": "2554798026153",
To get your friend's pictures you will need
Valid access token with friends_photos
HTTP GET \{friendId}\photos to get photo's the friend is tagged in
or
Valid access token with friends_photos
HTTP GET \{friendId}\albums to get a friend's albums listing, loop thru it to get the photos in each album by \{albumId}\photos
Try it out here: https://developers.facebook.com/tools/explorer

Categories

Resources