Open newFunL opened 2 years ago
Hi @newFunL,
Please could you try out a similar request in the 'Try this API' interface on this page and check whether the issue still exists? This helps to confirm if this is a client library issue or an API issue. If it is an API issue, I'll reach out to the API team for more information. Regarding the timezone, can you confirm that you're using America/Los_Angeles
as the docs mention The default and only supported timezone is America/Los_Angeles.
Regarding the error The requested metrics, dimensions and aggregation_period cannot be used together.
, what I've gathered so far is that this translates to no matching configuration
. Please let me know if you have any luck with the Try this API
page. The page may help to determine which parameters are causing the issue.
Thank you for your reply I used the correct time zone selection. I try to request in this way
credentials = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE,scopes=SCOPES)
request = google.auth.transport.requests.Request()
credentials.refresh(request)
token = credentials.token
headers = {"Authorization": 'Bearer ' + token}
url = "https://playdeveloperreporting.googleapis.com/v1alpha1/apps/{com.example.app}/errorCountMetricSet:query"
body = {
"metrics": ["distinctUsers"],
"dimensions": ["versionCode"],
"timelineSpec":{
"aggregationPeriod": "DAILY",
"startTime": {
'timeZone': {'id': 'America/Los_Angeles'},
'year': 2022,
'month': 4,
'day': 4
},
"endTime": {
'timeZone': {'id': 'America/Los_Angeles'},
'year': 2022,
'month': 4,
'day': 5
}
}
}
result_msg = requests.post(url=url,json=body,headers=headers).text
This error still exists,I think it seems that there is a problem with the corresponding API, please check it out
{
"error": {
"code": 400,
"message": "The requested metrics, dimensions and aggregation_period cannot be used together.",
"status": "INVALID_ARGUMENT"
}
}
Hi @newFunL, thanks for confirming the time zone used. I've created an internal issue for the API team. Googlers see b/229362343
Hi @newFunL, thanks for the bug report. The queries to errorCountMetricSet must specify the "errorType" dimension in the request, it is a required dimension. I have looked at the API docs and we missed documenting this. Sorry! I will get the API docs fixed asap.
I can confirm that adding reportType
to dimensions fix the issue.
Thanks for reply. I can add reportType to dimensions fix the issue.
Hi ,apologies for the off topic or irrelevant question, I am trying to pull the Method: vitals.crashrate.get using the Postman framing my get request as GET https://playdeveloperreporting.googleapis.com/v1beta1/{name=apps/*/crashRateMetricSet} the required OAUTH scope given in the reference document is https://www.googleapis.com/auth/playdeveloperreporting
I could not find this scope in the https://developers.google.com/identity/protocols/oauth2/scopes
I am now lost as i am not sure which scope to be used. Please help me
Hi @trinath89,
the API right now only supports access with GCP service accounts, which don't use scopes (scopes are only used with human accounts). Could you send me a link to the documentation where it talks about OAuth scopes? I will have it fixed.
If you have a strong need for human account access in the API, could you let me know what is the use case? It will be useful when it comes to prioritising new features.
Thanks
Hi @galbgonz,
Thanks a lot for the reply, I have never worked with API's before, so i was not sure how to get the data for crashRateMetricSet.
Previously: I followed this guide https://developers.google.com/android-publisher/authorization which did not asked me to create the service accounts and was only using OAUTH to generate the bearer token and access token and was able to retrieve the reviews via Postman. so I misinterpreted that I can follow the same process to retrieve the data for crashRateMetricSet.
Understood from your comment that, i need to create the service account with proper permissions.
any guide explaining the process to get the data for the below metric using the service account via postman will be greatly helpful to me. https://developers.google.com/play/developer/reporting/reference/rest/v1alpha1/vitals.crashrate/get
Please refer to the Authorization Scopes section in the above mentioned link that probably needs to be corrected .
Thankyou once again.
Hi @trinath89,
thanks for the details. I have confirmed that the scope is actually still needed to generate a bearer token even when using service accounts.
The way to use a service account is roughly as follows:
I assume you have done (1), and (2) since you were able to fetch reviews. If in step 3 you downloaded the key into a file named key.json, you can then use this command to get a bearer token:
$ oauth2l fetch --json ~/key.json --scope playdeveloperreporting
As I said the API OAuth scope currently is only enabled to work with service accounts. We're planning to allow person OAuth tokens too but the timeline is unclear at the moment.
Environment details
3.6.8
21.2.3
google-api-python-client
version:2.44.0
Code example
Stack trace
I have completely referred to the corresponding API documents to fill in https://googleapis.github.io/google-api-python-client/docs/dyn/playdeveloperreporting_v1alpha1.vitals.errors.counts.html#query My question is:
Are there any errors in my parameters and how to correct them
Thanks!