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

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.

Related

GET request to Patch Management API (Patch Manager Plus - Cloud)

I followed the instructions in the Patch Manager Plus - Cloud (https://www.manageengine.com/patch-management/api/) . And then get information (like refresh_token, client_id, client_secret), get access_token for every hour.
When trying to initiate a GET request to api/1.3/som/computers, I get the following response back.
{
"message_response": "Unable to retrieve details, Please try again later.",
"error_code": 90004,
"error": "invalid input found",
"message_version": "1.0",
"status": "error"
}
My code is as follows:
axios.get('https://patch.manageengine.com/api/1.3/som/computers', {
headers: {
"Authorization": << access_token >>
}
})
I think there is a problem with the header such as missing some parameters. (I tried running the api in the browser (logged in) and got the data). I also searched but couldn't find a description for this part.
Can anybody help me, please?

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 '%'

Getting 200 OK abd 400 bad request on the same request from Google Drive REST API

My Google Drive app checks on start if its settings files(the files are all on Drive) has changed. Thus on every start sends a files.list request to the Google Drive API to get the files metadata. The app has been used for more then 4 months with no suspicious beahaviour from this request. But the last few days a strange thing is happening. The problem is that from time to time(every 1 out of 10-20 starts) the request gets this response
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid Value",
"locationType": "parameter",
"location": "q"
}
],
"code": 400,
"message": "Invalid Value"
}
In all other cases the request gets an adequate response(200 OK mostly :)).
This is very strange because every time the request is the same and the query string( the q parameter) of course is the same i.e.
GET https://www.googleapis.com/drive/v2/files?corpus=DEFAULT&q=(title%3D'%5BClosed+Captions%5D.profile'+or+title%3D'Profiles'+or+title%3D'%5BGeneral%5D.profile'+or+title%3D'%5BTeletext%5D.profile'+or+title%3D'ezt5RoamingSettings.ini'+or+title%3D'ezt5ProjectSettings.ini'+or+title%3D'Project+Templates'+or+title%3D'ezt5IOPresets.ini'+or+title%3D'dicAutoCorrect.xml'+or+title%3D'dicShortForms.xml'+or+title%3D'dicDictionaries.xml')+and+trashed%3Dfalse&fields=items(fileSize%2C+id%2C+title%2C+modifiedDate%2C+md5Checksum%2C+parents(id%2C+isRoot))&key={MY_API_KEY}
Any ideas why is this happening will be much appreciated...

How to figure out the boundaries on Graph API's limit parameter

According to https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0,
Some edges have an upper maximum on the limit value, for performance reasons. We will return the correct pagination links if that happens.
A recent response for https://graph.facebook.com/20531316728/feed?limit=500&access_token=CAACE... is
{
"error": {
"message": "(#100) The 'limit' parameter should not exceed 250",
"type": "OAuthException",
"code": 100
}
}
However (as documented) some endpoints allow limit=500. The response has error code 100 and error type OAuthException but the message tells a different story. What is a good way to detect that the HTTP 400 Bad Request response is because of the limit parameter?
This issue has been raised to Facebook developer team. https://developers.facebook.com/bugs/763425230375017/

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

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