1
I’m wearing the following package to store contacts in the service provided by Google
, that is to say, Google Contacts
.
Requests of the type GET
They work perfectly and I can extract the contacts correctly.
However, when I make a request POST
, the following error is returned:
Uncaught Exception: { "error": { "code": 429, "message": "Resource has been exhausted (e.g. check quota).", "status": "RESOURCE_EXHAUSTED", "details": [ { "@type": "type.googleapis.com/google.rpc.QuotaFailure", "violations": [ { "subject": "QUOTA_EXCEEDED", "description": "FBS quota limit exceeded." } ] } ] } } in C:\xampp\htdocs\GoogleContactsAPI\vendor\rapidwebltd\php-google-people-api\src\GooglePeople.php:132
I know the error is clear, however, the return is not correct because I did not exceed the Cota
, only have 6 requests made
I leave here the code used (the initial variavies are not filled in because they are secret):
<?php
$clientId = '';
$clientSecret = '';
$refreshToken = '';
$scopes = '';
$googleOAuth2Handler = new GoogleOAuth2Handler($clientId, $clientSecret, $scopes, $refreshToken);
$people = new GooglePeople($googleOAuth2Handler);
if(isset($_POST['submit'])) {
$nome = htmlspecialchars($_POST["inputName"]);
$email = htmlspecialchars($_POST["inputEmail"]);
$number1 = htmlspecialchars($_POST["inputNumber1"]);
$number2 = htmlspecialchars($_POST["inputNumber2"]);
$city = htmlspecialchars($_POST["inputCity"]);
$state = htmlspecialchars($_POST["inputState"]);
$contact = new Contact($people);
$contact->names[0] = new stdClass;
$contact->names[0]->givenName = $nome;
$contact->emailAddresses[0] = new stdClass;
$contact->emailAddresses[0]->value = $email;
$contact->phoneNumbers[0] = new stdClass;
$contact->phoneNumbers[0]->value = $number1;
$contact->phoneNumbers[1] = new stdClass;
$contact->phoneNumbers[1]->value = $number2;
$contact->addresses[0] = new stdClass;
$contact->addresses[0]->city = $city;
$contact->addresses[0]->region = $state;*/
$contact->save();
if ($contact->save()) {
echo "<script type='text/javascript'>
$(document).ready(function(){
$('#modalResponseSuccess').modal('show');
});
</script>";
}else{
echo "<script type='text/javascript'>
$(document).ready(function(){
$('#modalResponseError').modal('show');
});
</script>";
}
}
?>
Has anyone ever been in a similar situation ?
Thank you.
You have the message "QUOTA_EXCEEDED" and status 429 (Too Many requests), this is called Traffic Management or Throtting, which allows certain users or groups to limit the number of requests, diagonally among others, protecting from DDOS attacks and securing the service for those who effectively pay for the service and have no limits for example, I do not know this api, but the reason is this, you exceeded the total number of requests you can make, or the time limit (daily/hour/minute).
– Ernesto Casanova
@Ernestocasanova hello, thanks for the reply. I’m with the free annual experience that google offers ($300 credit). My question (and analyzing the information provided by them) is that I only made 6 requests and gave this error. Orders
GET
work in the same.– Adriano Maia