I have a problem with Facebook Graph API. Is there any way to "attach multiple photos within a status post" using the Graph API (Javascript SDK)?
With the iOS Facebook app can post a status with multiple photos.
However, after looking through the documentation on internet I couldn't find out how it works.
Does anyone have idea? This a status screenshot that I would like to generate with the Facebook API.
This could be a solution:
Create a post with just a message, get its ID
Upload all your photos with { "published" : "false" }, get their
IDs
Update each photo with { "target_post" : "<yourPostID>",
"published" : "true" }
Did you see this documentation ? https://developers.facebook.com/docs/opengraph/usergeneratedphotos/
it might help you
Related
I am trying to access the live views count of a live video that is live through a Facebook Page. I am using the ID that I am obtaining from the API request {page-id}/videos/uploaded When I am using that video id and making a GET request of {video-id}?fields='live_views its showing error code of 100 with the message as:
(#100) Tried accessing nonexisting field (live_views) on node type (Video)
I have the following permissions:
'manage_pages', 'publish_pages', 'business_management', 'read_insights', 'user_videos'
I am making the GET request using user_access_token.
I am using Graph API Version 2.8.
Please let me know if I am using the wrong ID. IF yes, then how can i get the live_video_id of a live video posted in page?
To get the live views count of a video a fan page, you need:
An app created at facebook developer
A user access token (for testing, e.g. by calling https://developers.facebook.com/tools/accesstoken/)
The fan page id
With this you can call graph API in the following format:
https://graph.facebook.com/v2.8/<fan_page_id>/live_videos?access_token=<access_token>?fields=live_views
Of course, you may add more elements in fields parameter if you need more information. Here Facebook's Graph API explorer helps: https://developers.facebook.com/tools/explorer
When you add status to fields parameter, "LIVE" means, it's currently live, "VOD" means it has already finished.
If you try to implement a WebHook for it, let me now if it works. Thanks.
To get live views you need to call the api with the live video id, which you get from calling, page id can initially be either the page-id or name
"https://graph.facebook.com/v10.0/${page_id}/live_videos?access_token=${access_token}
Sample response:
{
"title": "hello world 2",
"status": "LIVE",
"embed_html": "...,
"id": "123123" // this is the live video id
},
After you have retrieved the live video id you can call this endpoint to get the live_views edge
https://graph.facebook.com/v10.0/${live_id}fields=live_views&access_token=${access_token}
sample response:
{
"live_views": 1,
"id": "123123"
}
Docs for endpoint 1: https://developers.facebook.com/docs/graph-api/reference/live-video/
Docs for endpoint 2: https://developers.facebook.com/docs/graph-api/reference/live-video/reactions#Reading
However I understand the confusion since live_views is not listed under the second endpoint as a reaction nor even is it a reaction, so either it a mistake in facebook docs or a mistake in the graph API, either the solution provided works.
Yes you do need to go through an app review to get the permission for tracking streams
I have a Facebook and Foursquare place named as 'Aenea Tattoo Studio'
If I
use its Facebook ID in the Instagram API /locations/search as a facebook_places_id=1594009447547294
use its Foursquare ID in the Instagram API /locations/search as a foursquare_v2_id=54fe044a498eb8d13d38b6bf
I receive this response:
{
"data" : [],
"meta" : {
"code" : 200
}
}
meaning that I have no location on Instagram linked to this Facebook/Foursquare place.
How can I create an Instagram location so that my Facebook/Foursquare place is connected to the new Instagram location?
Somehow the Page is not directly mapped/indexed to Instagram. Although it seems that the place is indexed.
If you get the location from the Facebook Place, and then use that to search in Instagram, using the following call:
https://api.instagram.com/v1/locations/search?lat=59.9129486&lng=30.2961197&distance=100
In the results you will see:
{
"latitude": 59.912869271,
"id": "171453560",
"longitude": 30.297031403,
"name": "10-я Красноармейская ул."
},
which I believe is the same address as the Facebook Page.
I'm not sure if there is a guarantee that all Facebook Pages/Locations should also be available via the Instagram API; I'll try to find that out for you.
About Foursquare I would not know. Hopefully somebody else can help you with that.
I'm looking for informations about this fanpage : https://www.facebook.com/gabrielmedinasurf
when I call the graph API (v1.0) at https://graph.facebook.com/gabrielmedinasurf
I get nothing but a RTFM message :
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
This process was supported a month ago. Does anyone had to face the same problem ?
I know the page ID : 206550296052269
but calling the API with it gave me the same result (https://graph.facebook.com/206550296052269)
Note : The v1.0 should be available until April 30, 2015 (source : https://developers.facebook.com/docs/apps/changelog)
Any help is welcome
NOTE : On this older post from SO, the process seems to work : Get Facebook fan page ID
Always use an Access Token for any Graph API call. That being said, the Page may be restricted by age or location, an App Access Token is not good enough in that case. You can only use a User Access Token or Page Access Token. I just tried with a User Token and it worked for that Page.
If you don´t know how to handle the different Access Tokens, take a look at the following links:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
I am trying to fetch a Facebook page's events. I have before, but it doesnt work any more. I used this scriptto fetch the events.
$string = file_get_contents("https://graph.facebook.com/?$pageids&fields=events.limit($fblimit)&access_token=$token&method=GET");
$json_a=json_decode($string,true);
$pageids was a lot of different facebook ids (id1,id2,id2 ...)
I get this error message:
{
"error": {
"message": "(#100) Unknown fields: events.",
"type": "OAuthException",
"code": 100
}
}
Does anyone know what is wrong with my script? Is there a another way to fetch Facebook events?
The actual URL to get a page's events is something like this :
https://graph.facebook.com/PAGE_ID/events
I'm not sure how old the code is that you are fixing, but this is the correct method as stated in the documentation. events is a connection of the page object.
Reference: https://developers.facebook.com/docs/reference/api/page/#connections
Facebook has had restricted access of Events in API recently.
You have to do app review to have access to Pages API, Events API.
Please check section "Apps that Require App Review, Business Verification, and Supplemental Terms" of this url: https://developers.facebook.com/docs/apps/review
I heard there is a way to get stats for URLs from Facebook using FQL. Is there a way to do this using the Open Graph?
Yes.
You can retrieve link stats from Graph API endpoint.
For example, accessing https://graph.facebook.com/?id=http://example.com will get you a response like this:
{
"id": "http://example.com",
"shares": 47068
}