Google Drive API does not allow to post file - google-api

I am getting the following error when trying to upload files. How can i get this number increased?
POST https://content.googleapis.com/drive/v2/files?alt=json
{"title":"4394480","mimeType":"application/vnd.google-apps.folder","labels":{"restricted":false},"params":{"fields":"items(id)","quotaUser":"U1VQRVI="},"parents":[{"id":"0B_driE4U__5YWlhvd3VGRm5famc"}]}
Response 403
{
"error": {
"errors": [
{
"domain": "global",
"reason": "numChildrenInNonRootLimitExceeded",
"message": "The limit for this folder's number of children (files and folders) has been exceeded."
}
],
"code": 403,
"message": "The limit for this folder's number of children (files and folders) has been exceeded."
}
}
Error message code:
"numChildrenInNonRootLimitExceeded"

If you check the google drive errors page here
You will see that the problem is that your directory simply has to many files in it you can not add more. This is a hard limit from within google drive and nothing that can be changed Google drive limits
create another directory and upload to that.

Related

Gmail API error 429 - how to resolve the error?

This is the error I am getting from Gmail, and I am wondering how to resolve this. It appears I have reached a quota.
Mailer: Gmail
{
"error": {
"code": 429,
"message": "User-rate limit exceeded. Retry after 2021-02-15T06:43:03.309Z
(Mail sending)",
"errors": [
{
"message": "User-rate limit exceeded. Retry after 2021-02-15T06:43:03.309Z (Mail sending)",
"domain": "global",
"reason": "rateLimitExceeded"
}
],
"status": "RESOURCE_EXHAUSTED"
}
}
There are two types of quotas, project based quotas which are applied to your full project and user based quotas which are applied to the authenticated user who is making the request.
User rate quotas are flood protection they ensure that a single user does not make to many requests at one time
User-rate limit exceeded. Retry after 2021-02-15T06:43:03.309Z
(Mail sending)",
The error message you are getting now tells you that you have exceeded the send mail quota and you can make a request again after 2021-02-15T06:43:03.309Z .
Solution wait until after 2021-02-15T06:43:03.309Z to make another request, and when you start making requests make sure to slow down so you don't make to many requests and exceed your quota again. A specific technique to retry requests and wait is the exponential backoff where you try a request and wait exponentially increasing periods of time if it fails to give the server time enough for not overpassing the rate limit.
Reference
Resolve 429 error in Gmail API
Retry failed requests
Exponential backoff

People API - QUOTA_EXCEEDED / FBS quota limit exceeded

The google people api page says correctly how to authenticate and list 10 example contacts and everything works perfectly:
https://developers.google.com/people/quickstart/python
I can authenticate and list 10 perfectly but I'm having an error when trying to create new contacts.
The api is returning me the following error:
HttpError: <HttpError 429 when requesting https://people.googleapis.com/v1/people:createContact?alt=json returned "Resource has been exhausted (e.g. check quota).". Details: "[{'#type': 'type.googleapis.com/google.rpc.QuotaFailure', 'violations': [{'subject': 'QUOTA_EXCEEDED', 'description': 'FBS quota limit exceeded.'}]}]">
when i click on https://people.googleapis.com/v1/people:createContact?alt=json, i have the following json on page:
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
I changed the scopes perfectly, even creating contacts a few months ago.
Out of nowhere everything stopped working and I'm having trouble QUOTA_EXCEEDED and FBS quota limit exceeded
I redid the entire authentication process and even tried to list contacts and without problems, everything works perfectly LESS the creation of contacts
Some observations:
I use via jupyter notebook and I'm also logged in to the email where
I want to create the contacts
I've tried to run in an IDE and the same problem
I've created 26888 contacts this way
This project does not appear on the Google console because I think I
did the entire project through documentation page, and I believe that the quotas have not been exhausted, just because I can see the values ​​correctly. I create on average 1 contact every 3 seconds and 200 contacts per day (maximum)
I would like a lot of help to know why I can't create more contacts, I have a lot of work pending because of that, thanks.
my code to create contacts:
def main():
creds = None
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'credentials.json', SCOPES)
creds = flow.run_local_server(port=0)
# Save the credentials for the next run
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)
service = build('people', 'v1', credentials=creds)
#----------------creatingc contacts----------------------
print('trying')
for i in df_banco_linhas[:2]:
if i[1] not in df_csv_linhas:
time.sleep(3)
service.people().createContact( body={
"names": [
{
"givenName": i[0]
}
],
"phoneNumbers": [
{
'value': i[1]
}
]
}).execute()
print('create: ' + i[0])
time.sleep(3)
else:
print('NO')
if __name__ == '__main__':
main()
As the problem was only happening when creating contacts, I decided to investigate the limit on the number of contacts and I came across the limit of 25000 in the documentation.
I was forced to create another email to solve the problem and increase my capacity to 50000 contacts (synchronizing two emails).
Their error message denotes that the problem is in the quota limit (requests), when in fact it is limit of contacts by email.
I was getting this same quota limit exceeded error ("FBS quota limit exceeded.") for a different reason. I was supplying values too long for the Organization.jobDescription field.
Perhaps this specific quota limit triggers when some non-rate constraints are violated, like total number of emails or maximum length of fields.
This may not be intended, since that kind of violation doesn't fit the 429 status code, and that limit is not listed in the Quotas section of the API/Service Details page for the People API in the console.

Getting 500 error consistently on Google Sheets API

I am using the Google Sheets API and consistently getting the following error. I am only getting it for a specific sheet with a specific service key. My other credential is working just fine. Also the load relatively load from what I can tell. I'm not railing the API or anything.
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"errors": [
{
"message": "Internal error encountered.",
"domain": "global",
"reason": "backendError"
}
],
"status": "INTERNAL"
}
}
I have found the culprit here. It looks like I had to remove two sheets with Pivot Tables on them referencing a sheet I was trying to query. Once I did that all is well now.
This has to do with their internal timeout. If an operation that you are trying to complete is taking longer, it will bail. Until they fix this a solution may be to reduce the size of data to make the operation quicker. In my case, I update the spreadsheet in smaller chunks.
A workaround for this can be having a central sheet to update data from the Google Sheet API, then reference the range of this data using a formula like IMPORTRANGE on the sheet you need to have your charts and analysis. This way, the sheet that is accessed by the API won't have any chart and wouldn't have any issue.

Upload more than 50 Videos using YouTube API

I have a new channel with no videos uploaded yet. When I tried uploading some 500 videos I had using the YouTube Data API, the upload process stopped after about 50 videos. I do not understand how my quota limit reached 300,000 (the per 100 second default limit) as the quota required for uploading 1 video is just 1600. I have to upload around 500-600 videos every day as the nature of my business is such. Please help.
[RequestError] Server response: {
"error": {
"errors": [
{
"domain": "youtube.video",
"reason": "uploadLimitExceeded",
"message": "The user has exceeded the number of videos they may upload."
}
],
"code": 400,
"message": "The user has exceeded the number of videos they may upload."
}
}
This is a user based quota and not a project based quota. It has nothing to do with what you are seeing on the Google Developer console.
The quota used to be:
400 video uploads, 1500 write operations, and 50,000 read operations that each retrieve two resource parts.
Google has apparently changed how the quota works. A user can upload 50 videos then only one video every 15 minutes until the quota resets. Quota resets at midnight west cost USA time.
I have an email out to the team looking for feed back on this.

dailyLimitExceeded errors, but API Console shows 21% of quota

Using the Ruby API client, a service account, and at the "courtesy limit" of 50k requests/day, we start seeing this error after making just a few hundred requests.
{
"error": {
"errors": [
{
"domain": "global",
"reason": "dailyLimitExceeded",
"message": "Quota Error: profileId ga:REDACTED has exceeded the daily request limit."
}
],
"code": 403,
"message": "Quota Error: profileId ga:REDACTED has exceeded the daily request limit."
}
}
The API console shows that we are only at 21% of quota. The other day, the error started happening when we were around 51% of quota.
Our usage has never been very aggressive:
In addition to the account-wide limit of 50,000 requests/day, there is a smaller limit of 10,000 requests per profile/day you're probably hitting:
Core Reporting API and Real Time Reporting API
These quotas are specific to the Core Reporting API and Real Time
Reporting API:
10,000 requests per view (profile) per day
10 concurrent requests per view (profile)

Resources