Google Play Games Services(Web): Retrieves the Player resource error - google-play-games

I used APIs Explorer with request parameters:
playerId => me
Then I got response:
{ "error": { "code": 500, "message": null } }
Url: https://developers.google.com/games/services/web/api/players/get?hl=zh-TW
API Url: https://www.googleapis.com/games/v1/players/playerId
Now our website can't get player id by this API. A user who logged in our website can't shop. What happened?

Related

What does a 404 mean in the context of a Google Calendar API?

I am trying to programatically access a calendar I own using the Google Calendar API list:
r = requests.get(
url="https://www.googleapis.com/calendar/v3/calendars/<the ID of my calendar which looks like mydomain_randomstuff#group.calendar.google.com>/events",
params={
'key': <the key from the API console>,
'singleEvents': True,
'orderBy': 'startTime'
}
This call fails with a 404:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Not Found"
}
],
"code": 404,
"message": "Not Found"
}
}
What does that error actually mean, in the context of this API?
Note:
the calendar does exist and it has events
the API limits are not even close to be reached
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Not Found"
}
],
"code": 404,
"message": "Not Found"
}
}
Can mean one of two things. Either the calendar Id you have typed is in correct or the user who you are authenticated with does not have access to that calendar. Make sure you are logging in with the correct user with access to that calendar. Optionally you can do a calendar.list which will return a list of the calendars that the user currently has access to. That way you wont have to worry about possibly miss typing the calendar id.
authorization
The method you are using events.list requires authorization (permission from the user) in order to access their calendar. Which can be seen in the documentation page
You need to authncate your user using Oauth2 and one of the scopes above. You will then have an access token you can use to access this calendar.
apikey
Api keys are used for accessing public data. Unless your calendar is set to public you will not be able to use it to see events. Also remember that api keys do not have access to update public calendars you still need to be authenticated to make changes to them.
Service account
If this is a server to server application you should use a service account not an API key. All you need to do is add the service account as a user on the google calendar like you would any other user. It will then have access to your calendar.

Gmail API using service account is getting delegation denied error message

I am developing a web-based application using Google API. I am using server-to-server which is obviously with a service account. I am almost done.
I can now insert new users through Google api. I can even create and/or give newly created users access to a Team Drive through Google API. Meaning, I have a service-account that can impersonate all domain users.
The Problem:
But why am I getting errors when trying to impersonate a user through Gmail API? I need to add Gmail Labels and Filters to newly created users but I am getting an error message stating "Deligation denied". Am I missing something?
Obviously I have a working service-account settings already with proper scopes in G Suite. I guess userID "me" is not an option since my application needs to impersonate a newly created G Suite user. Please correct me if I am wrong.
$service = new \Google_Service_Gmail($this->client($scopes));
$serviceLabel = new \Google_Service_Gmail_Label();
$serviceLabel->setLabelListVisibility('labelShow');
$serviceLabel->setMessageListVisibility('show');
$serviceLabel->setName($label_name);
try {
$resp = $service->users_labels->create($email, $serviceLabel);
} catch (Google_Service_Exception $e) {
return false;
}
Here is the error I am getting
{#398 ▼
+"statusCode": 403
+"errors": array:1 [▼
0 => array:3 [▼
"domain" => "global"
"reason" => "forbidden"
"message" => "Delegation denied for service-account-user#domain.com"
]
]
+"message": """
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Delegation denied for service-account-user#domain.com"
}
],
"code": 403,
"message": "Delegation denied for service-account-user#domain.com"
}
}
"""
}
A Gmail Label is expected to be added automatically for each user being created through the application.

Getting 401 response in google developer api only when query GET subscriptions

I'm using Google Play Android Developer API. I access it from server with service account. I have private key and got access token with it.
I use scope https://www.googleapis.com/auth/androidpublisher. And when I ask subscription info, I got 401 error:
"error": {
"errors": [
{
"domain": "androidpublisher",
"reason": "permissionDenied",
"message": "The current user has insufficient permissions to perform the requested operation."
}
],
"code": 401,
"message": "The current user has insufficient permissions to perform the requested operation."
}
But when I use other queries with the same token and with the same scope, I got successfull responses. For example, I can successful get voided purchases list or info about inapp product:
200 OK
{
"packageName": "com.myapp.exapmle",
"sku": "subscr_month",
"status": "active",
"purchaseType": "subscription",
"defaultPrice": {
"priceMicros": "149000000",
"currency": "RUB"
}
What could be the cause of the problem? I added this service account to developer console and provided all permissions (administrator access).

Using the insert method of the Google Data Transfer API to start a transfer

I am trying to use the transfers:insert method of the Google Admin SDK Data Transfer API. I am performing this API call as the super admin account of my domain. I have verified that API access is enabled for our domain, and that the Super Admin admin role has permission to use the Data Transfer API.
I am testing this in the APIs Explorer on this page.
55656082996 is the ID string that I got for Google Drive from the applications:list APIs Explorer.
Request:
POST https://www.googleapis.com/admin/datatransfer/v1/transfers?key={YOUR_API_KEY}
{
"oldOwnerUserId": "olduser#ourdomain.com",
"newOwnerUserId": "newuser#ourdomain.com",
"applicationDataTransfers": [
{
"applicationId": "55656082996"
}
]
}
Response:
400 OK
- SHOW HEADERS -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid value for: Invalid oldOwnerUserId."
}
],
"code": 400,
"message": "Invalid value for: Invalid oldOwnerUserId."
}
}
I get the same "Invalid value for: Invalid oldOwnerUserId." response no matter if I use email addresses or usernames. I also tried excluding the applicationDataTransfers array from the response, but that also didn't work.
The documentation does not say this, but the Id cannot be the user's email address, like in all of the other Google APIs, but rather it needs to be a numeric ID for the user that you can get using the Users:get Directory API method.
I figured this out by Google searching and coming across this documentation, where they elaborate upon oldOwnerUserId by saying "# ID"
In addition to the answer above.
Here is how you can get the employee' IDs from Gsuite API in Python 3.*
def create_directory_service():
credentials = cls.get_credentials(scopes=['https://www.googleapis.com/auth/admin.directory.user'])
return build('admin', 'directory_v1', credentials=credentials, cache_discovery=Fals
service = create_directory_service()
old_owner_google_id = service.users().get(userKey=old_owner).execute()['id']
new_owner_google_id = service.users().get(userKey=new_owner).execute()['id']

Updating signature of all users in my Google domain account

Hi am trying to build an app to standardized signatures of all users in my google domain.
For that I have tried with following Google APIs in apis explorer
https://developers.google.com/apis-explorer/?hl=en_US#p/gmail/v1/gmail.users.settings.sendAs.patch
and pass other user's Id and email with custom signature but it's giving me following error
REQUEST
<pre>
PATCH https://www.googleapis.com/gmail/v1/users/[21_DIGIT_USER_ID]/settings/sendAs/[SOME_OTHER_USER#DOMAIN.COM]?fields=signature&key={YOUR_API_KEY}
{
"signature": "my custom signature"
}
</pre>
RESPONSE
<pre>
403 Forbidden
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Delegation denied for myemailid#mydomain.com"
}
],
"code": 403,
"message": "Delegation denied for myemailid#mydomain.com"
}
}
</pre>
Although I have delegated admin access and I am able to change my user's signature by passing me in userId field and email id in sendAsEmail.
What's the use of userId field if an delegated admin can't change other user's signature.

Resources