In the Facebook Graph API Explorer (and also via PHP SDK), /act_9876543/adsets?fields=campaign_id,ads{name}&filtering=[{field: "id",operator:"IN", value: ['334455']}] correctly returns adset 334455 (and its ads) and shows that its campaign_id is 122222.
However, the result of /act_9876543/campaigns?fields=adsets{name,ads{name}}&filtering=[{field: "id",operator:"IN", value: ['122222']}] does NOT include adset 334455 (even though it should, according to the "Nested Requests" docs, right?).
Similiarly, the result of /campaigns?fields=adsets.limit(5000){ads.limit(5000){name},name},name&limit=5000 is missing many adsets and ads. (I'd expect it to return everything because I have fewer than 50 total campaigns, and each campaign has fewer than 50 adsets, and each adset has fewer than 50 ads).
Am I misunderstanding how Nested Requests should work?
Related
When trying to fetch Facebook insights API for the following action offsite_conversion.fb_pixel_purchase I always get less number than Facebook show on their ad manager, I tried to inspect their network calls and URL structure and I see they're using the same field offsite_conversion.fb_pixel_purchase to show Results I am not sure why the numbers are mis-matching. I tried to query from the Graph API and from my shell with the same results.
You may check use_account_attribution_setting and use_unified_attribution_setting in here: https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group/insights
Setting use_unified_attribution_setting to true worked for me.
I did some testing and found out that if you use an additional breakdown, FB will return less conversions. There might be a bug in their API when you use breakdowns.
I tried getting offsite_conversion.fb_pixel_purchase with
'breakdowns' => 'hourly_stats_aggregated_by_advertiser_time_zone',
and facebook retuned 5 conversions.
if I remove the breakdown and get the data grouped daily I get 11 conversions which is what Facebook Ads Manager shows
I have a development level access to Marketing API and it looks like I cannot read some fields of specific objects.
For example I try the following call:
You can see that promoted_object, link_url and object_url are not displayed in the result. And I should have one of those three value as the Ads was ad to promote "web site click".
Is it a bug or a limitation of the development acces or I am doing something wrong?
It is true that not all fields are readable by all apps, however in the case above it is most likely that these fields are empty on that object and therefore not returned in the response.
Promoted object, for example, is required on the adset level now, however it may be the case the adset you are trying to read is very old and therefore does not have one specified.
In regards to the creative fields, again not all creatives have these fields and in the case they are empty, are not returned in the response. You should check the promoted_story_id to see if this contains what you're looking for.
I'm attempting to retrieve all of my favourited songs from my profile on SoundCloud using the SoundCloud API method /users/{id}/favorites.
After registering my application with SoundCloud and retrieving my ClientID, I can successfully retrieve an array of favourited tracks in JSON using a call to http://api.soundcloud.com/users/goodforenergy/favorites?client_id={my-client-id}.
Looking at my SoundCloud profile, however, you can see I have (at this moment in time) 182 likes - but the method is only returning 48.
Any ideas as to why? I thought there may be a next_href returned in the JSON that I was expected to follow to retrieve more, but I don't see any. In any case, 48 seems a very arbitrary number to return!
According to soundcloud api docs most of the results in the API are returned in collections which are limited by default to a size of 50. I realize that it's peculiar that you are seeing 48 rather than 50 but it's probably worth modifying your call to support pagination.
Most endpoints support a linked_partitioning parameter that will allow you to page through collections. When this parameter is passed, the response will contain a next_href property if there are additional results.
So you need to update your API call to include the linked_partitioning and limit parameters in order to recieve a next_href.
I'm trying to collect all the posts of my company page with this kind of query
https://graph.facebook.com/v2.2//feed?limit=250&fields=id,type,status_type,comments{id},likes{id},shares
Problem is that I'm not collecting all posts.
I will have a better result with limit=20 and some time with limit=100
Most of the pages (from the pagination mechanism point of view) will not have 100 items.
I know some posts may not be exposed because of privacy settings.
My issue is that a call with limit=20 is not returning once going through pagination the same amount of data as limit=250.
How could it be?
How providers of Facebook Analytics can garanty the quality of data they collect ?
The Facebook graph api only allow the max of 100 items per request, despite you specify more than that.
Afaik the limit parameter is indeed buggy. But 250 would be a very high value, there is a max value for the parameter too - i assume it depends on the API call how high it is, could be fixed too.
Better donĀ“t use limit at all and use paging to get more results: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#paging
Currently i am using following FQL query :-
https://api.facebook.com/method/fql.query?query=select post_id,likes FROM stream WHERE source_id=XXXXXXXX LIMIT 0,10000&access_token=XXXXXXXXXXXXX&format=json
I have two Facebook Accounts / pages & able to download data using above API. Able to retrieve posts & post likes count.
But, from last three days, for one Facebook account above FQL query is not working. it is returning message :- "error": "Request failed" . For other account it is working fine.
For each facebook Account / pages i have generated separate Access Tokens.
But, if i update limit from : -
Limit 0,50
Limit 50,100
then it is working & returning posts from page but not returning all post which i have previously getting from Limit 0,10000
Please help me, if any one have idea about this issue ?
Thanks
Facebook will cancel queries which take too long or too many resources to execute. In general, I would never use LIMITs which are that high. There's a high probability that they will fail, and you can't really incfuence the query execution "load" other than setting the LIMIT to a reasonable number (which means implementing a paging mechanism).