PAGE_ID/insights/page_fans/lifetime?until=DATE gives OAuthException for some dates - facebook

For some of my fanpages, it gives OAuth error , once you try to get data using /PAGE_ID/insights/page_fans/lifetime Facebook API.
What excatly happened was, I used PAGE_ID/insights/page_fans/lifetime?until=2013-05-04. It pulling through data. But if I use PAGE_ID/insights/page_fans/lifetime?until=2013-05-03 , that means same query a day before the first query, it gives
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1
}
}
Does any have proper explanation for this?

you cannot use date range in /insights/page_fans/lifetime
query it without any parameters
you can combine
/insights/page_fans/lifetime
/insights/page_fan_removes
/insights/page_fan_adds
to get a daily reading

Related

Getting error 400 on the API end point runReport, the front end doesn't give me errors with same dimensions and metrics

I’m trying to use the API for GA4. Before December 5 I was able to do the following call: "url": "https://analyticsdata.googleapis.com/v1beta/properties/307276000:runReport", "method": "POST", "body": "{\n"dimensions":[\n{\n"name":"date"\n},\n{\n"name":"deviceCategory"\n},\n{\n"name":"pageLocation"\n},\n{\n"name":"pageTitle"\n},\n{\n"name":"sessionCampaignName"\n},\n{\n"name":"sessionSourceMedium"\n}\n],\n\ "metrics":[\n{\n"name":"screenPageViews"\n},\n{\n"name":"newUsers"\n},\n{\n"name":"engagedSessions"\n}\n],\n"dateRanges":[\n{\n"startDate":'2022-12-02',\n"endDate":'2022-12-12'\n}\n], \n"limit":"10000",\n"offset":0,\n"keepEmptyRows":true\n}" } And it was successful, but starting December 5, now I get the following error: { "error": { "code": 400, "message": "Please remove pageLocation to make the request compatible. The request's dimensions & metrics are incompatible. To learn more, see https://ga-dev-tools.web.app/ga4/dimensions-metrics-explorer/", "status": "INVALID_ARGUMENT" } } I get the results from the front end. Trying to understand what is the problem.
The front end gives me the results without an error, I keep getting the error since December 5.

Facebook Marketing API returns error on "breakdowns call"

I'm trying to make an API call with the folowing URL
act_XXXXXXXX/insights?fields=ad_id,clicks,unique_clicks,impressions,reach,spend,date_start,date_stop,actions,action_values,unique_actions,account_id&level=ad&breakdowns=platform_position&time_range={"since":"2019-09-07","until":"2019-09-07"}
and the response is :
{
"error": {
"message": "(#100) Current combination of data breakdown columns (action_type, platform_position) is invalid ",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "XXXXXXXXXXXXXXXXXXXX"
}
}
the reason is in "breakdown" value = "platform_position"
but the problem is that I need exactly that breakdown :(
when I do an API call and change "breakdown" in URL to something else, for example to "publisher_platform":
act_XXXXXXX/insights?fields=ad_id,clicks,unique_clicks,impressions,reach,spend,date_start,date_stop,actions,action_values,unique_actions,account_id&level=ad&breakdowns=publisher_platform&time_range={"since":"2019-09-07","until":"2019-09-07"}
it is OK and responds with data.
I don't know why it happens because I'm not specifying any "action_type" breakdown but it tells that I am :(
What I've tried:
I tried to remove all the parameters from that URL one by one but it still returns an error
The main questions are: why the API call for "breakdown" value = "platform_position" fails and how to make it work.
Thanks.
PS: you can use FB API testing tool to test requests to FB api.
I'm using API version v8.0
You will need both publisher and position:
breakdowns=publisher_platform,platform_position

Facebook Graph: unable to get group feed

I'm trying to get the group feed via Facebook Graph API.
According to the documentation
https://developers.facebook.com/docs/graph-api/reference/v2.8/group/feed
I'm trying to costruct the appropiate url and here it is
https://graph.facebook.com/v2.8/154205721275156/feed?access_token=[TOKEN]
And each and every time I'm getting the next result
{ "error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "B7/12QU7BW/"
} }
[TOKEN] is valid, it applies to the member of the group.
At the same time other requests for the same group, such as "/events" or "/members", return correct answers.
What is wrong with the "/feed" request?

Facebook Graph API: The "Next" link for "Paging" is not working

I'm getting the feed from a page through the Facebook Graph API. At the end there is a link given, in order to retrieve the next page of the feed, as shown here (I removed my access token):
"paging": {
"previous": "https://graph.facebook.com/v2.8/14408401557/feed?fields=from,message,link,created_time,type,name,id,comments.limit\u0025280\u002529.summary\u002528true\u002529,shares,reactions.limit\u0025280\u002529.summary\u002528true\u002529&limit=100&since=1483025111&access_token=XXX|XXX&__paging_token=enc_AdABZBt6ZC7DctahZAsXG9wOUghwu8tMLYo1ZAlMdLcVCwa8VqVjBEsZABFiLRSVlA96xTQzKkrnd2ALIlGrGLhZALSum7&__previous=1",
"next": "https://graph.facebook.com/v2.8/14408401557/feed?fields=from,message,link,created_time,type,name,id,comments.limit\u0025280\u002529.summary\u002528true\u002529,shares,reactions.limit\u0025280\u002529.summary\u002528true\u002529&limit=100&access_token=XXX|XXX&__paging_token=enc_AdBOFdepWf3pcZBDLiV0r00WXJZA8qN7iYCZCzrwSoZCxYuKnHvXVUyCp35KCz4CW35p0gsmQV3Vzs5xKXe16QyCKMEN"
If I try to use the given url, I get the following error:
"error": {
"message": "Syntax error \"Expected \")\", got end of string\" at character 171: from,message,link,created_time,type,name,id,comments.limit(u0025280\\u002529.summary\\u002528true\\u002529,shares,reactions.limit\\u0025280\\u002529.summary\\u002528true\\u002529",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "Dxf6QrEjBl6"
}
Does anybody know why?
They seem to be encoded fine as output of JSON. But my guess is you are not decoding them before using. e.g.
comments.limit\u0025280\u002529.summary\u002528true\u002529
e.g. if you replace manually it works
comments.limit%280%29.summary%28true%29
See this answer https://stackoverflow.com/a/3020108/1542667 for an explanation of JSON encoding of strings, \u0025 is just '%'

Unix Time-Stamps in Facebook Graph API

Is anyone else experiencing problems with Graph API requests that use UNIX time stamps this morning? For example, last night the following query worked, but it does not work this morning- perhaps it has something to do with the recent server issues reported by Facebook last night?
Query entered into Facebook Graph API Explorer:
/[pageid]/posts&since=1311062400&until=1313740800?fields=id&limit=10000
Error message:
{
"error": {
"message": "Unknown path components: /posts&since=1311062400&until=1313740800",
"type": "OAuthException",
"code": 2500
}
}
Your query is incorrect
/posts&since=1311062400&until=1313740800
^
|
-------
That should be ?
/posts?since=1311062400&until=1313740800