Facebook GraphQL: query ads with a certain image - facebook-graph-api

I'm trying to get statistics for user's ads that use a certain image. I know hash of this image. I need to send request from server-side. I managed to get all ads by querying
/me/adaccounts?fields=id,name,adimages{hash,name},insights{clicks,impressions,ctr}
and then iterating over the list, but it seems wasteful on resources. Is there a way to query only those apps that have specific image in them? I can't find anything in FB docs on requesting specific values.

Related

How to get ondemand ids for Vimeo API

I am trying to work with the Vimeo API and I cannot figure out how to access the ondemand data.
The endpoint and parameters in the docs require an ondemand_id to work correctly. I assumed this ID would come from any official ondemand page within Vimeo. But whenever I search the ondemand pages of Vimeo and click on a resource, the URL does not contain any numerical ID.
It only contains the root path for the Vimeo website with /ondemand_page_name at the end. This value cannot be the ID since it is a string and not a number. I have looked through the entire page plenty of different times to try to find the ID but cannot seem to find it.
For example, when you visit a normal video page on Vimeo, the URL looks something like this:
https://vimeo.com/272976101
where the number 272976101 is the video_id that can be used within the API to get all the data about this particular video. Instead of this format, the ondemand pages have the format:
https://vimeo.com/ondemand/nebula
where there is no numerical ID within the URL. This is the issue I am having. How would I retrieve the public data about this ondemand page throught the API.
I feel like there may be a very simple solution/explanation to this issue and any help would be much appreciated.
Also, right now I am not using any SDK to access this data. I am strictly trying to figure out how the API works through the built-in client provided within the documentation.
It's undocumented, but you can use the On Demand custom url path as the ondemand_id.
So for your On Demand video at https://vimeo.com/ondemand/nebula, you can make an API request to this path: https://api.vimeo.com/ondemand/pages/nebula.
In the response, you'll see the "uri" value "/ondemand/pages/203314", which you can log on your end and use as the ondemand_id instead of /nebula.
Also note, this should be the same URL as your On Demand settings page: https://vimeo.com/ondemand/203314/settings
I hope this information helps!

Cannot fetch large type picture for multiple Facebook object ids Graph API

I just can't figure it out, i am using Facebook graph API to fetch data, lets say i have a multiple Facebook objects and i want their picture in type=large...
I saw some posts like this one
How do I mask Facebook graph api URLs for pictures?
That suggesting to do the following: /?ids=OBJECT_IDS&fields=picture&type=large
The thing is that it seems the once the picture is specified as a field like the above the type URL parameter doesn't seem to effect the retrieved picture.
If there is a way to fetch large type pictures of multiple Facebook objects in one request via the graph API please let me know...
Thanks
All you really need is the object's id.
If its a user then his/her user_id.
If its a page then the page_id.
etc...
Once you have that you can simply use this URL to get the large image -
https://graph.facebook.com/OBJECT_ID/picture?type=large
You don't really have to request the large image as you can place this URL directly as a link to the image. In HTML for example -
<img src="https://graph.facebook.com/4/picture?type=large" />
The problem with obtaining all the large images of different types of object is that they are all located at different endpoints. You would be able to get multiple pictures for the same type of object. For example -
by user_id
select pic_big from user where uid in(4,5,6)
by page_id
select pic_big from page where page_id in(1,2,3)
by event_id
select pic_big from event where eid in(1,2,3)
by group_id
select pic_big from group where gid in(1,2,3)

Is it possible to get insight metrics using Facebook API

I am interested in fetching all data available on this page (https://developers.facebook.com/docs/opengraph/insights/) with Facebook API. Is it possible to get raw data to use with my own graphing tools?
Yes. You can query the insights table using either the Graph API or FQL.
The insights documentation is not very clear, and in FQL especially, you need to manually ask for data points one period at a time. The FQL documentation is worth reading even if you're using the API since it defines all the different metrics which are available.
Visit the Graph API Explorer, get an access token with the Extended Permission read_insights and type /PAGE_ID_OR_USERNAME/insights into the search box. You'll see a bit of what is available.
You can drill down by adding parameters to the end of the url. For instance /PAGE_ID_OR_USERNAME/insights/page_fan_adds_unique/day?since=-1 month gets you a json object with the unique page fan adds each day for about the past month.
You are only able to get insights data for a page where you have admin rights.

HTML5 Canvas to Facebook

I've made a basic HTML5/JS comic creation tool that uses the canvas element.
I want users to be able to upload their comics via the Facebook API.
I don't believe Facebook allows posting images in the form of base64 strings from the canvas.toDataURI() method, and don't want to use my own server to convert these images & temporarily store them.
What's the best way to go about this? Possibilities I've wondered about: Convert canvas to blob? Store blob via web service (if so, suggestions?) Upload blob directly to Facebook? (Is that possible?)
I don’t see why this should not be possible doing a „normal” upload. You can create a new photo for a user by posting to PROFILE_ID/photos, with a source parameter of type multipart/form-data.
So first thing I’d try is getting the picture info from the canvas object into a „normal” form (writing it into a input element in the right format(?)), and sending that to Facebook. If this step succeeds, I’d see if jQuery or some other lib’s form.serialize method can build requests of type multipart/form-data. If that’s also possible, then there should be no further problem in taking the data in that format and posting it using FB.api (although you might want to tell your users to be patient, because that might take a while).
Can’t tell for sure if this’ll work, but I’d give it a try.
Facebook partners with Heroku for free app hosting, you can use it as the temporary server.

Facebook Page - Get Post feedback and impression via Graph API

I'm trying to get some insights on a list of Posts by a Page on Facebook.
To be specific, I want to get the information highlighted in this blog post via the API.
But I can't figure out how, anyone knows how?
As far as I know it's only possible using the "stream" table. So you've got to use FQL to query this data. Using this technique you'll only get the impressions directly. Feedback rate can be calculated by adding #comments and #likes and dividing the result by #impressions. Hope they'll add this to the insights graph api as well.
MartinHN
Refer to https://developers.facebook.com/docs/reference/api/#analytics
If you are trying to aggregate multiple pages or a page other than the requesting app then you may need grant read_insights permissions to your application.
Refer to http://developers.facebook.com/docs/reference/api/insights/