Facebook Graph API - Fetch public event - facebook

I am new to the Facebook GraphAPI, the idea is to use it from Java facebook-sdk.
But at the moment I am just trying to run a simple request to fetch a public event
https://graph.facebook.com/v11.0/{event_id}?access_token={access_token}
But I am getting this error:
{
"error": {
"message": "Unsupported get request. Object with ID 'XXXXX' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "Apc-nisB6j0fD2LB--0gTSa"
}
}
I wonder if I need more permissions from organiser of the event, but the event says
"Public ยท Anyone on or off Facebook"
So why would we need permissions? I just need to fetch some data from the event like name, description and cover url.. I could do it by simple parsing the source code of the page, but API will be much more efficient. Could it be because its just postman or browser?
Thanks.

You don't need Facebook Marketing Partner status to get info about events.
All you need is:
App with "in development" status,
User access token obtained from https://developers.facebook.com/tools/explorer/
Create a GET request, for example
https://graph.facebook.com/**EVENT-ID-HERE**?fields=cover,name,description,start_time,end_time,id,attending_count,created_time,declined_count,interested_count,maybe_count,event_times,place,updated_time,ticket_uri,type,discount_code_enabled,noreply_count&access_token=**ACCESS-TOKEN**
Its worth to note, that
You should be "Interested" or "Going" to an event which data you want to GET info;
Event ID's should be extracted manually.
For the idea I personally do in this way:
Copy paste all event links to google sheet (and pressing interest)
With =SPLIT[cell;"/"] sheet formula I extract event IDs
Then I run script, that gets all the info Event contains.
Sorry for my unprofessional way of explaining things, I am not a Developer and I found this question because I am looking for answer about how to extract event cover photo without a specific App status. :))
I hope that this helps or anyone can explain this better.

Related

Facebook Instagram Graph Api Get Tags with username

I tried the Instagram-Graph-Api because the current Instagram-API will be shut down soon.
I want to retrieve posts, created with a specific Hashtag and read the Username who created that post.
Unfortunately the username-Field is not supported in the IG Hashtag API
You cannot request the username field on returned media objects.
OK, that's maybe a Facebook-Limitation. So I tried to fetch the Details of an object with the IG Media API. This Api works for Media-Objects what I created with my linked Facebook-Account for the Access-Token, but it does not works with other, public accounts.
Facebook wrote:
Fields marked with an asterisk (*) are public fields, which means they can be returned by an edge using field expansion.
And the username-Field in the documentation is wrapped with an *. So I think it's a public information to what we should have access to?
I do not found any limitation on facebook saying that the IG Media Api only allows to retrieve Elements from Pages where my Access-Token is authorized to, is this currently a limitation because my Facebook-App was not reviewed by Facebook?
This is the Graph-API-Call what I made:
GET https://graph.facebook.com/v7.0/18142822621010864?user_id=17841402377690736&fields=id%2Cusername&access_token=
And this is the response what I get:
{
"error": {
"message": "Unsupported get request. Object with ID '18142822621010864' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "AMi0N96iFZ65hgvS1D1upsO"
}
}
Thank you
Matthias
Ok did a lot of research on this one last night. And simply put, Facebook locked down their api pretty hard.
You are not able to see any specific of a media item not owned by yourself.
You are not able to see any comments when your are not tagged or mentioned in the post
You are not able to get the username of media found via hashtags for example.
You should be able to see replies on your comments added to public media you do not own.

An unknown error has occurred with graph Facebook

I have an element on my website which shows facebook posts from a page and the amount of views/likes/comments. This stopped working all of a sudden and I have no idea why.
If I make the request with the graph api tester tool I get:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "CIHVxFhXIv/"
}
}
This is the request link I use with file_get_contents:
https://graph.facebook.com/v3.0/idofmypage/posts?fields=comments,full_picture,likes,message,picture,story,permalink_url,updated_time,from,insights.metric(post_impressions)&access_token=myaccesstoken
Did something change again with permissions or maybe a field is deprecated?
According to this fb new the Pages API and others have changed, and now you can only access the data if it's a page of your own.
Pages API: Until today, any app could use the Pages API to read posts or comments from any Page. This let developers create tools for Page owners to help them do things like schedule posts and reply to comments or messages. But it also let apps access more data than necessary. We want to make sure Page information is only available to apps providing useful services to our community. So starting today, all future access to the Pages API will need to be approved by Facebook.
Today I've started a project wich, in the begging, I need to recollect data and that's what I've found about it..

POST /{application_id}, cannot update ios_bundle_id

Facebook's Graph API documentation lists the application object's ios_bundle_id field under the "Updating" section. However, sending a POST request to update said field, e.g.
POST: https://graph.facebook.com/v2.3/{application_id}?ios_bundle_id=["com.Company.AppName"]&access_token={app_access_token}
Responds with this error message:
{
"error": {
"message": "(#100) ios_bundle_id cannot be edited using the API. Please use the Developer App to edit settings instead.",
"type": "OAuthException",
"code": 100
}
}
I am able to update this field through the Developer App page, but in my case, I need to update this field programmatically.
I have successfully tested that same POST request to update other fields, e.g. app_name, so I am certain the request is structured properly.
Has anyone encountered this issue, or similar? Any suggestions are appreciated.
This is a documentation error. This field is not editable via the Graph API. You have to go into your Facebook Application Dashboard and change it from there.
Here's a link to the bug report created to fix this:
https://developers.facebook.com/bugs/1646835812217089/

Fetching a Facebook page's events?

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

Error with Twitter link

Yesterday I started a new app on Facebook. Today I got the message that when people copy the link to Twitter they get an error. This is what you get:
{
"error": {
"message": "Unknown path components: /your_namespace:your_action",
"type": "OAuthException",
"code": 2500
}
}
What does this mean? What could be the problem?
Are you actually sending the POST action link to Twitter? Why?
I think you misunderstood how Open Graph works. Basically, you should be the one publishing actions when users take an action using your service. You can use a server-side or a client-side language to POST request (when you click a link, your browser actually makes a GET request, not a POST) to https://graph.facebook.com/me/namespace:action?access_token=ACCESS_TOKEN&OBJECT_PATH=OBJECT_URL
Note that you need to create an app, use it to authenticate users to get the access token and also set your custom actions / objects. These will need to be approved before you can actually use them.
You should start by taking a look at the sample apps to see how they work: https://developers.facebook.com/docs/samples/