google cloud mailer api 429 error Resource has been exhausted (e.g. check quota) - gmail-api

i get the below error randomly when using the google mailer api to send emails using the wordpress post smtp plugin, i can replicate the email if i send 200 bulk emails, but checking the peak it doesnt get near the peak, any failed emails i have to re-send
{
"error": {
"code": 429,
"message": "Resource has been exhausted (e.g. check quota).",
"errors": [
{
"message": "Resource has been exhausted (e.g. check quota).",
"domain": "global",
"reason": "rateLimitExceeded"
}
],
"status": "RESOURCE_EXHAUSTED"
}
}

rateLimitExceeded is flood protection your going to fast slow your code down.

Related

Error 403, Metadata scope doesn't allow format FULL . Web application Gmail API get message through postman

I'm getting forbidden 403 error when hitting Gmail API get message through postman please help me how to solve this. error
https://www.googleapis.com/gmail/v1/users/userId/messages
this url for getting message list
https://www.googleapis.com/gmail/v1/users/userId/messages/id
this is for getting message for particular id
I can able to hit the get message list API but get Message API not working for me
I'M doing all these stuff through postman
error message :
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Metadata scope doesn't allow format FULL"
}
],
"code": 403,
"message": "Metadata scope doesn't allow format FULL"
}
}
This is another disappointing design in the Gmail API. I resolved this issue with the following steps:
Remove GmailScopes.GMAIL_METADATA from scopes setup.
Remove the credential file from your local FileSystem. This file is generated by Google's Authorization Flow which store your credential locally.
Re authorize your app by signing in again https://accounts.google.com/o/oauth2/auth?access_type=offline....
Hope this helps you guys out.

Google Drive upload file rest api returns 401 error

I want to store my json object to google drive.
And google authentication is working fine.
But when I am calling google drive api, it returns 401 error.
I set authentication, content-type, and content-length to api headers.
Not sure why this happen.
401: Invalid Credentials
Invalid authorization header. The access token you're using is either expired or invalid.
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization",
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
Suggested action: Refresh the access token using the long-lived refresh token. If this fails, direct the user through the OAuth flow, as described in Authorizing Your App with Google Drive.

How to detect if Google account hasn't Gmail

How can I recognize Google accounts without Gmail?
I use OAuth2 for authorization and then download user messages.
But if Google account hasn't Gmail, then I receive the error while getting data from api:
{
"errors": [
{
"domain": "global",
"reason": "failedPrecondition",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
What is the best way to detect accounts without Gmail?
Now I just send test GET request to gmail-api and check that it returns OK.
But I'm looking for best solution.

User not authorized to perform this action when setting IAM policy

I am setting up a topic and trying to grant permission to gmail to send email notification to this topic, but the API call throws "User not authorized to perform this action". I get the same error when I tried from the https://cloud.google.com/pubsub/reference/rest/v1/projects.topics/setIamPolicy. BTW, I started seeing this issue recently. It was working fine before.
POST https://pubsub.googleapis.com/v1/projects/macro-xxxxx-xxx/topics/exxxxx-inxxx:setIamPolicy?key={YOUR_API_KEY}
{
"policy": {
"bindings": [
{
"role": "roles/pubsub.publisher",
"members": [
"serviceAccount:gmail-api-push#system.gserviceaccount.com"
]
}
]
}
}
{
"error": {
"code": 403,
"message": "User not authorized to perform this action.",
"status": "PERMISSION_DENIED"
}
}
Appreciate any help, Thanks.
You likely do not have permission to modify the topic in question. You need at least the Pub/Sub Editor or Pub/Sub Admin permission to modify the allowed publishers on a topic. These can be more easily changed in the IAM Console than by the REST API.

Mirror API Playground not posting to timeline

I believe I've gone through all the steps of creating a (web) client-id for authorizing requests from the Mirror API Playground, yet when I hit the Authorize button, and then Insert a card from a template, nothing is sent to glass.
I also note that the Timeline tab below is empty.
Web I bring up developer tools, I note that the POST to https://www.googleapis.com/rpc is returning results:
[
{
"error": {
"code": 403,
"message": "Access Not Configured",
"data": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured"
}
]
},
"id": "gapiRpc"
}
]
Am I missing something in how to authorize the Mirror Playground?
You need to enable the Google Mirror API.
Do this by toggling the switch on the Services panel for your project as pictured here:
. This toggle will only be visible if you have been whitelisted for the Google Mirror API as part of the developer preview.

Resources