Google API and batch requests for different APIs and limites - google-api

The google calendar API and the google drive API allows batch requests.
To do so, you need execute a POST on www.googleapis.com/batch
And the body of the request contain the list of GET/POST/DELETE of your differents requests.
According to https://developers.google.com/google-apps/calendar/batch and https://developers.google.com/drive/web/batch
You can even group requests for multiple users or multiple Google APIs.
Does it mean I can send a request for the calendar API and a request for the drive API in the SAME batch ?
If so, https://developers.google.com/google-apps/calendar/batch says :
You're limited to 50 calls in a single batch request. If you need to make more calls than that, use multiple batch requests.
And https://developers.google.com/drive/web/batch says :
You're limited to 1000 calls in a single batch request. If you need to make more calls than that, use multiple batch requests.
Which value is the correct one ?
More about others APIs :
For https://developers.google.com/webmaster-tools/v3/how-tos/batch
They forgot to give the host name ( www.googleapis.com ? ). In the example they just put :
Host: host
They say the limit is 1000 but didn't say if you can call others APIs in the same batch
For https://developers.google.com/admin-sdk/reseller/v1/how-tos/batch
They show in the example :
POST https://www.googleapis.com/batch
They say the limit is 1000 and specify :
You can even group requests for multiple users or multiple Google APIs.

After experiments, It is not possible to mix differents API (calendar, drive, ...) in the same batch. So each API has its own limit.
And, for google calendar, there is another limitation :
Cannot perform operations on different calendars in the same batch request.
(error "400 Bad Request", reason "cannotOperateOnDifferentCalendarsInBatch")

Related

Mailchimp API Issue with Batch Requests using 'skip_merge_validation=true' for add list Operations?

Have any others had a problem adding Contacts to a list via Batch Request in Mailchimp API v3?
It appears that there may be a bug in the Mailchimp Marketing API, version 3.0.
This issue occurs when executing a Batch Request.
When the Operations contained in the Batch Request are for adding members to a list: https://mailchimp.com/developer/marketing/api/list-members/add-member-to-list/
If the available Query Parameter, 'skip_merge_validation' is set as "?skip_merge_validation=true" for each Operation within the Batch, then each of these Operations will fail.
If the 'skip_merge_validation' parameter is not used, the Batch executes successfully.
If these same add list transactions are submitted one at a time...not inside a Batch Request, they execute successfully.
The following is typical text of the response error-->
"status_code": 404, "operation_id": "72df952af8795581869d7dedb620c329", "response": "{\"type\":\"https:\/\/mailchimp.com\/developer\/marketing\/docs\/errors\/\",\"title\":\"Resource Not Found\",\"status\":404,\"detail\":\"The requested resource could not be found.\",\"instance\":\"\"}" }
Below is a typical add list Operation that would be wrapped within the Batch Request:
body={"id":"","email_address":"webmaster#lalala.com","status":"subscribed","merge_fields":{"FNAME":"Harry","LNAME":"Smith","BIRTHDAY":"","ADDRESS":{"addr1":"","addr2":"","city":"","state":"OR","zip":"","country":""},"VNCUSTNBR":"5190"},"MD5_hashed_email_address":"24fda9bd05aa2039600ae060ef41f779"}
method=POST
operation_id=24fda9bd05aa2039600ae060ef41f779
path=/lists/QWERTY/members?skip_merge_validation=true
update_existing=False

How to check Global HTTP batch endpoint is called

I received an email saying that JSON-RPC and Global HTTP Batch serving endpoints being discontinued, and that my project on Google Cloud Platform is calling Global HTTP Batch endpoint.
When I check the API dashboard of the project, however, "Google Cloud Storage JSON API" shows no usage for the last 30 days.
Does that mean the project no longer calls this endpoint?
If not (= if there is still a chance that we call this endpoint), how can I see whether a change that I will make to eliminate the call does actually eliminate the call?
If you are using a client from Google to make your request you are no longer calling the Global HTTP Batch endpoint as they have been updated to use the new API specific Batch endpoint.
You can still use the dev tools from your browser to check the request url from your app.

api.ai Fullfillment POST requests doesn't append the action in the POST URL

Currently all the Fulfilment requests originating from api.ai are, POST requests to the base url configured in api.ai Fulfilment section. But to be able to have proper routing (microservice style) set-up on the server side it would be more worthwhile to append the action in the POST URL.
For a substantially large project, there can be hundreds of fulfilment actions and managing all of them in single monolithic project is cumbersome. If the action comes in the URL, then we can configure and organise the actions into multiple cloudfunctions in case of firebase hosting / server side microservices.
Edit:
As answered by matthewayne, I can use my own proxy set-up to route the requests to achieve the goal. But I don't want to introduce any additional delay into the request processing. Because I am expecting huge number of webhooks being fired. This would be a very easy implementation for Google api.ai team to incorporate that allows for a greater flexibility! Hence expecting an answer from google team!
Currently this isn't possible with API.AI's webhook design. I'd recommend setting up a proxy service that unpacks the webhook requests from API.AI, inspects the action and sends the proper request to the proper microservice endpoint and then forwards the response back to API.AI once the microservice has returned its result:

Turn rate limit (throttle) down for a specific origin in Laravel 5.4

I have a Laravel-made API running in a server and an Angular application running in another server. My Angular app loads a huge JSON file (with more than 500 lines) and tries to insert each line in a database through the api. A request is sent for each line, so I get an 409 error (too many requests).
I know this is a matter of security, so I don't want to remove the throttle from my middlewareGroup array in Kernel.php. I'd like to know, however, if there's any chance I can turn this rate limit down for a specific origin address (http://www.myangularapp.com/ only, for example)? So I can send these various requests while keeping the rate limit for other origin addresses.
Thanks in advance!

Coldfusion concurrent ajax post

I'm creating a script for uploading and processing something.
user upload an excel file
in the destination script, the excel data are converted to a query
the query converted to json using SerializeJSON
and then this json data is submitted one by one using ajax and setInterval function
currently the interval for setInverval is set to 500 (milliseconds). so far is safe and doesn't kill the web server.
from Firebugs Console tab, with this interval I saw maximum 2 concurrent ajax request.
is there any limitation on maximum concurrent ajax request when using CF and IIS?
I'm using CF 9 standar edition with IIS in win 2008 server.
Thank you
(sorry, english is not my mother tounge :p)
Why not loop the Excel document and save the lines server side instead of submitting one by one with additional HTTP requests?
As for your question see what follows:
Maximum Number of Requests
The bottleneck is most likely the
browser. Have a look at this
question:
How many concurrent AJAX (XmlHttpRequest) requests are allowed in popular browsers?
I don't think IIS limits requests.
ColdFusion requests limits are set in
the administrator under Server
Settings > Request Tuning. By default 10 processing, up to 1000 more queued.

Resources