Facebook Graph API /me/Feed V2.4 vs V2.3 - facebook

I'm trying to access all feeds a facebook user using the Graph API .
However I'm getting quite different responses from V2.3 to V2.4 .
In version 2.4 using the instruction / me / Feed not receive complete information of the posts just returns some fields , while in the previous version had access to all the information. As can be seen the difference in the following answers.
V2.4
{
"data": [
{
"message": "A brincar com o Xico Zé.. ;)",
"created_time": "2015-07-11T18:23:59+0000",
"id": "10153293007088673_120153297333223673"
},
{
"message": "Ana Simões e Pedro Simões este é que é bom para a Liliana Assunção..",
"story": "Diogo Lopes shared Classic Hits 4FM's video.",
"created_time": "2015-07-11T14:20:59+0000",
"id": "10153293007088673_1360153296966998673"
}
],
"paging": {
. . .
}
}
V2.3
{
"data": [
{
"id": "10153129496378673_120153297333223673",
"from": {
"name": "Diogo Lopes",
"id": "10153129496378673"
},
"message": "A brincar com o Xico Zé.. ;)",
"picture": "",
"link": "",
"name": "Diogo Lopes on Instagram: “A brincar com o Xico Zé.. ;)”",
"caption": "Diogo Lopes on Instagram: “A brincar com o Xico Zé.. ;)”",
"description": "A brincar com o Xico Zé.. ;)",
"icon": "https://www.facebook.com/images/icons/post.gif",
"actions": [
. . .
],
"privacy": {
"value": "ALL_FRIENDS",
"description": "Your friends",
"friends": "",
"allow": "",
"deny": ""
},
"type": "photo",
"status_type": "added_photos",
"object_id": "120153297333233673",
"application": {
". . ."
},
"created_time": "2015-07-11T18:23:59+0000",
"updated_time": "2015-07-12T20:50:19+0000",
"is_hidden": false,
"subscribed": true,
"is_expired": false,
"likes": {
. . .
],
"paging": {
. . .
}
},
"comments": {
"data": [
. . .
],
"paging": {
. . .
}
}
},
{
"id": "10153129496378673_1360153296966998673",
"from": {
"name": "Diogo Lopes",
"id": "10153129496378673"
},
"to": {
. . . },
"message": "………....",
"message_tags": {
. . .
},
"story": "Diogo Lopes shared Classic Hits 4FM's video.",
"story_tags": {
"0": [
{
"id": "10153129496378673",
"name": "Diogo Lopes",
"type": "user",
"offset": 0,
"length": 11
}
],
"19": [
{
"id": "125659037470226",
"name": "Classic Hits 4FM",
"type": "page",
"offset": 19,
"length": 16
}
],
"38": [
{
"id": "874724002563722",
"name": "",
"offset": 38,
"length": 5
}
]
},
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xta1/v/t15.0-10/s130x130/11331624_874724179230371_2123630990_n.jpg?oh=701da51ed6690c70ba8d3e7ba5cbb58c&oe=56273FFC&__gda__=1448812275_e37392fe85f01402fa0565b0086df710",
"link": "https://www.facebook.com/ClassicHits4FM/videos/874724002563722/",
"source": "https://video.xx.fbcdn.net/hvideo-xtp1/v/t42.1790-2/11656282_889978921061393_14476072_n.mp4?efg=eyJybHIiOjQ4NCwicmxhIjo1MTJ9&rl=484&vabr=269&oh=a4e7e8ec985cf5374082e5c9639d5b06&oe=55A5ED2C",
"name": "Classic Hits 4FM",
"description": "A Giant Nope!!!
Would you go on this Swiss Ride?",
"actions": [
. . .
],
"privacy": {
"value": "EVERYONE",
"description": "Public",
"friends": "",
"allow": "",
"deny": ""
},
"type": "video",
"status_type": "mobile_status_update",
"created_time": "2015-07-11T14:20:59+0000",
"updated_time": "2015-07-11T21:28:06+0000",
"is_hidden": false,
"subscribed": true,
"is_expired": false,
"likes": {
. . .
],
"paging": { . . . }
},
"comments": {
}
…
}
Someone can help me know how I can get a similar response in V2.4 to V2.3??
Obs. My facebook aplication have user_posts Permission.

Since the upgrade in Graph API i.e. version 2.4. You have to specifically pass a fields parameter with the relevant keyword of which, data you would like to retrieve.
Please refer to this document of Facebook Developers
Changes from v2.3 to v2.4
Declarative Fields
To try to improve performance on mobile networks, Nodes and Edges in
v2.4 requires that you explicitly request the field(s) you need for
your GET requests. For example, GET /v2.4/me/feed no longer includes
likes and comments by default, but GET
/v2.4/me/feed?fields=comments,likes will return the data. For more
details see the docs on how to request specific fields.
An example of v2.4:
<page_id>/feed?fields=id,message,picture,likes,shares,comments

Related

When creating a template in whatsapp cloud api it is always rejected

I am trying to create a template from postman by sending this object:
{
"name": "listado_productos",
"language": "es",
"category": "TRANSACTIONAL",
"components": [
{
"type" : "HEADER",
"format": "document",
"example": {
"header_handle": [
"https://drive.google.com/file/d/1CcTpDZL3p0ltMFhIKU9Vhz1LWG0bQFpN/view?usp=share_link"
]}
},
{
"type": "BODY",
"text": "Buenas tardes, acá le enviamos el nuevo listado de precios. Muchas gracias"
},
{
"type": "FOOTER",
"text": "ABS."
}
]
}
If I try an example from the official business-management-api guide, it also rejects it for non-compliance with terms and conditions.
"name": "promotional_message",
"language": "en_US",
"category": "TRANSACTIONAL",
"components": [{
"type":"BODY",
"text":"Hi {{1}}, get an extra 10% off every order above $300.",
"example":{"body_text":[["Sonia"]]}
},
{
"type":"HEADER",
"format":"TEXT",
"text": "Bonus Tuesday starts now!"
},
{
"type":"FOOTER",
"text":"Not interested? Tap Stop promotions"
},
{
"type":"BUTTONS",
"buttons":[{"type":"QUICK_REPLY", "text": "Shop now"},
{"type":"QUICK_REPLY", "text": "Stop promotions"}]
}]
The response is that it is rejected for being duplicate or not complying with WhatsApp Busiess Api terms and services but it is not true, I read the terms and conditions and the file / message format complies. Does anyone identify the problem?

How to set review for revision using Gerrit REST API

I'm trying to setup Teamcity building and verifying patchsets from Gerrit. The last step should set Verified to -1 if build failed. I'm playing around with Gerrit REST API and I think I found a proper command:
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review
The documentation says:
As response a ReviewInfo entity is returned that describes the applied
labels.
My request looks like this:
POST <gerrit-url>/a/changes/I696f00f4968fcb35fa614ce6325499aa15367150/revisions/current/review
{
"message": "Build failed",
"labels": {
"Verified": -1
}
}
As a response I get full revision info:
{
"id": "dev_test~master~<change-id>",
"project": "dev_test",
"branch": "master",
"hashtags": [],
"change_id": "<change-id>",
"subject": "a test",
"status": "NEW",
"created": "2017-04-03 07:53:19.000000000",
"updated": "2017-04-04 08:47:34.000000000",
"submit_type": "MERGE_IF_NECESSARY",
"mergeable": true,
"insertions": 133,
"deletions": 7,
"unresolved_comment_count": 0,
"_number": 381,
"owner": {
"_account_id": 4,
"name": "<my-name>",
"email": "<my-email>",
"username": "<my-username>",
},
"labels": {
"Code-Review": {
"all": [
{
"value": 1,
"date": "2017-04-04 08:47:34.000000000",
"permitted_voting_range": {
"min": -2,
"max": 2
},
"_account_id": 4,
"name": "<my-name>",
"email": "<my-email>",
"username": "<my-username>"
}
],
"values": {
"-2": "This shall not be merged",
"-1": "I would prefer this is not merged as is",
" 0": "No score",
"+1": "Looks good to me, but someone else must approve",
"+2": "Looks good to me, approved"
},
"default_value": 0
},
"Verified": {
"all": [
{
"value": 0,
"permitted_voting_range": {
"min": -1,
"max": 1
},
"_account_id": 4,
"name": "<my-name>",
"email": "<my-email>",
"username": "<my-username>"
}
],
"values": {
"-1": "Fails",
" 0": "No score",
"+1": "Verified"
},
"default_value": 0
}
},
"permitted_labels": {},
"removable_reviewers": [],
"reviewers": {
"REVIEWER": [
{
"_account_id": 4,
"name": "<my-name>",
"email": "<my-email>",
"username": "<my-username>"
}
]
},
"current_revision": "913330441711b067899a664a60c78be518e547b4",
"revisions": {
"913330441711b067899a664a60c78be518e547b4": {
"kind": "REWORK",
"_number": 6,
"created": "2017-04-03 14:08:14.000000000",
"uploader": {
"_account_id": 4,
"name": "<my-name>",
"email": "<my-email>",
"username": "<my-username>"
},
"ref": "refs/changes/81/381/6",
"fetch": {
"ssh": {
"url": "ssh://<url>",
"ref": "refs/changes/81/381/6"
},
"http": {
"url": "http://<url>",
"ref": "refs/changes/81/381/6"
}
}
}
}
}
It's not affected by request. Same response is returned when I send request using GET method or using POST method with invalid JSON in body(!)
Gerrit version is: 2.13.6-3008-gcdc381e
Do I something wrong?
PS. Here is similar question, but it isn't helpful: Gerrit set-review api doesn't work
EDIT:
It seems that I getting response from GET request not POST
I figured it out. It's not gerrit problem. I used http request and our server redirected to https with 301 which the Postman fallowed and returned response for GET request.

facebook graph api doesn't return the statuses i shared

I'm trying to fetch all my facebook timeline posts throw the facebook Graph API.
I'm playing with the Graph Explorer and have an access token with this permissions: (user_posts, read_stream) but when i call the endpoint "/posts" or "/feed" in the graph-api, the statues i shared (not i created) on my timeline (friends public status that i shared) didn't return.
this is a screenshot from my timeline
any idea?
If you share another POST - status then I dont think there is a way that will show up in your feed. It will show up under the user's feed who originally shared it, under posts and sharedposts
But if you share a link then it will show up under your feed as shared_story
Example from my feed
{
"data": [
{
"id": "XXXXXXXX",
"from": {
"id": "XXXXXXXX",
"name": "XXXXXXXX"
},
"story": "Vrashabh Irde shared a link.",
"story_tags": {
"0": [
{
"id": "XXXXXXXX",
"name": "XXXXXXXX",
"type": "user",
"offset": 0,
"length": 13
}
]
},
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQAvV7MyLsxFjRDc&w=130&h=130&url=https%3A%2F%2Ftctechcrunch2011.files.wordpress.com%2F2015%2F05%2Fdave-goldberg.jpg%3Fw%3D560%26h%3D292%26crop%3D1&cfs=1&sx=1&sy=0&sw=292&sh=292",
"link": "http://tcrn.ch/1GR0HU3",
"name": "Dave Goldberg, SurveyMonkey CEO, Dies Unexpectedly",
"caption": "tcrn.ch",
"description": "Silicon Valley and the wider world of technology are mourning the very sudden death of Dave Goldberg, a long time entrepreneur and investor, CEO of..",
"icon": "https://www.facebook.com/images/icons/post.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/XXXXXXXX/posts/XXXXXXXX"
},
{
"name": "Like",
"link": "https://www.facebook.com/XXXXXXXX/posts/XXXXXXXX"
}
],
"privacy": {
"value": "ALL_FRIENDS",
"description": "Your friends",
"friends": "",
"allow": "",
"deny": ""
},
"type": "link",
"status_type": "shared_story",
"created_time": "2015-05-03T14:45:09+0000",
"updated_time": "2015-05-03T14:45:09+0000",
"is_hidden": false,
"subscribed": true
}
This is from what I know, I dont see any documentation that says otherwise, good to have someone from Facebook comment here or you should probably raise a bug if this is not intended.

Getting high res photos from Facebook News Feed API

I am trying to get a high resolution photo from the post below in my news feed. I tried calling https://graph.facebook.com/v2.1/10154603506630195 using the object_id based on advice here (getting high resolution photos that were posted on a page wall/feed) but it doesn't seem to work, any help would be much appreciated :)
{
"id": "10154603665915195_10154603509055195",
"from": {
"id": "10154603665915195",
"name": "John Smith"
},
"message": "I've taken up queuing as a new hobby during my short time in England. Here we are outside a store that won't open for another half hour...",
"picture": "https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/s130x130/10699259_10154603507605195_419931109_n.jpg?oh=ff3ec0e772fea164bbd9d61e9ee9a4d0&oe=540E80D2&__gda__=1410242521_d3b2dc1c8f971610b07e0408cd62815b",
"link": "https://www.facebook.com/photo.php?fbid=10154603506630195&set=a.10150303996795195.555860.698310194&type=1&relevant_count=1",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yx/r/og8V99JVf8G.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/10154603665915195/posts/10154603509055195"
},
{
"name": "Like",
"link": "https://www.facebook.com/10154603665915195/posts/10154603509055195"
}
],
"privacy": {
"value": ""
},
"type": "photo",
"status_type": "added_photos",
"object_id": "10154603506630195",
"application": {
"name": "Facebook for iPhone",
"namespace": "fbiphone",
"id": "6628568379"
},
"created_time": "2014-09-07T10:40:03+0000",
"updated_time": "2014-09-07T10:40:03+0000",
"likes": {
"data": [
{
"id": "711243852300920",
"name": "Megumi Yoshida Atobe"
},
{
"id": "10152707756462594",
"name": "Emily Stokes-Rees"
},
{
"id": "10152741507272044",
"name": "Lina Kumamaru Sato"
}
],
"paging": {
"cursors": {
"after": "MTAxNTI3NDE1MDcyNzIwNDQ=",
"before": "NzExMjQzODUyMzAwOTIw"
}
}
}
}
If you are using the FB Graph API, ask for the full_picture field in your request:
FB.api('10153224297552834_10153268631032834?fields=full_picture', function (response) {
console.log(response.full_picture);
});
Try specifying the attachments field in your request.
/v2.2/<someId>/feed?fields=attachments
This will give you an 'attachments' field, with some media inside. You'll find there high res images.

Get more detail from Facebook Notifications?

I'm writing an app that gathers info from a users Facebook notifications. Using the Graph Explorer, I request:
me/notifications?include_read=true
and this returns a bunch of data. Each item is a notification item you would see when logging into Facebook. For example (ID/names changed slightly):
{
"id": "notif_630262196_168132987",
"from": {
"name": "John Bloggs",
"id": "822724665"
},
"to": {
"name": "Dermot Bloggs",
"id": "680265196"
},
"created_time": "2013-01-23T22:58:28+0000",
"updated_time": "2013-01-23T22:58:28+0000",
"title": "John Bloggs commented on your link: \"Goodbye Great Barrier Reef. Goodbye...\"",
"link": "http://www.facebook.com/<removed>/posts/330788937030559?comment_id=1702155",
"application": {
"name": "Links",
"id": "2309869772"
},
"unread": 0,
"object": null
}
The notification is in relation to a comment, but the "title:" field gets truncated if it is too long.
Is there a clean way I can programmatically access the comment directly, so I can get all the text, even if it is a 1000 character comment?
Thanks! :-)
You should be able to get the comment by parsing the link field and querying:
/330788937030559_1702155
or
/POSTID_COMMENTID
When I tested this on my account, I am getting a comments object in the returned data, with the full text of the comments. I've got most permissions enabled in my Graph API. I suspect adding read_stream to the permissions is what will give you this data.
You can avoid parsing! I've been doing a lot of experimentation with notifications and getting what I've called the 'source' object (the source object being the Facebook Graph Object from which the notification originates). Unfortunately, I can't find any documentation on how exactly this mechanism works, but if your app has been granted a lot of permissions, the "object" field which in the JSON you posted is null will actually be populated with the 'source object'. Instead of just "object" : null it will look like this:
"object": {
"id": "587140489_588632201147717",
"from": {
"name": "Dave Rodríguez",
"id": "587140489"
},
"message": ":D ",
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-prn1/632550_478955408819349_478954732152750_60483_1892_t.jpg",
"link": "https://www.facebook.com/photo.php?v=478954732152750",
"source": "http://video.ak.fbcdn.net/hvideo-ak-prn1/v/754708_478955348819355_1792301950_n.mp4?oh=c7295ccfc3773f24de931e4c29f512ce&oe=513F1728&__gda__=1363127340_9302c108824176369427a0b17491b800",
"name": "¡¡¡EL SECRETO DE LA CHANCLA!!!!",
"description": "EL SECRETO DE LAS MADRES, EL MÁS UTILIZADO EN TODAS LAS GENERACIONES, VÉALO USTED MISMO Y ((COMPARTA))!",
"properties": [
{
"name": "Length",
"text": "1:13"
}
],
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/587140489/posts/588632201147717"
},
{
"name": "Like",
"link": "https://www.facebook.com/587140489/posts/588632201147717"
}
],
"privacy": {
"value": ""
},
"type": "video",
"status_type": "shared_story",
"object_id": "478954732152750",
"application": {
"name": "Video",
"namespace": "video",
"id": "2392950137"
},
"created_time": "2013-03-10T20:45:20+0000",
"updated_time": "2013-03-10T20:45:20+0000",
"likes": {
"data": [
{
"name": "Adrian Guerra Cuenta Verificada",
"id": "674364748"
}
],
"count": 1
},
"comments": {
"count": 0
}
}
I hope somebody more knowledgeable than me can tell us exactly what permissions we need to see this field populated. I'd figure it out myself but there are so many permissions that brute-forcing the SUM(nCk(77,k),k,1,77)=151115727451828646838271 possible combinations of permissions would take a very long time.