Listing all available shared drives in a google drive - google-api

I am trying to list all google shared drives using below api
GET https://www.googleapis.com/drive/v3/drives?pageSize=100&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
But can i list all drives with out giving pagesize parameter? It also says page limit is 100. Is there anyway we can list all drives without any limit.

If you check the documentation for drives.list you will see that it states
pageSize integer Maximum number of shared drives to return. Acceptable values are 1 to 100, inclusive. (Default: 10)
There is no way to set the page size parameter over 100. No you cant get drives without any limits the limits are in place so that we can all use the API together without any one person making a huge call that takes a lot of processing power.
you will need to use the page token and paginate your request.

Related

Google Drive API: list all files at once

Currently, I'm using Files: list API below to get all the files
https://developers.google.com/drive/api/v3/reference/files/list
Attached screenshot contains the parameters used where I've provided (pagesize=1000). This only returns 1000 files per call. I have to set (pageToken='nextPageToken' value from previous response)
Is there a way to for the API to return all the files instead of having to set (pageToken='nextPageToken' value from previous response) ?. Please advise
Answer: No there is no way to List more then 1000 files without pagination.
Addional information.
If you check the documentation that you yourself have linked
You will notice that it states that the default page size is 100, that means that if you don't send the page size parameter that it will automatically be set to 100 by the system.
You will also notice that it states Acceptable values are 1 to 1000, inclusive. this means that you can max set pagesize to 1000
If you want additional files you need to use the nextpagetoken to get another set of rows.
There is no other way around pagination if you want more then the 1000 rows. I dont know what your doing but maybe using the the Q parameter to search for just the files you are looking for and thereby limiting the response to under 1000.
Also note that my testing suggests that you get 100 back for My Drives and 460 (?) for Shared Drives. I have never got 1000 back for either type. You will need to iterate each "page" in turn

Pinterest API Rate Limits

We currently use our applications to download some pins information for analytics purposes
Currently we hit the API on hourly basis but we have some problems with rate limiting, so we need the following questions to be addresses:
The documentation states that the rate limit is 1000 calls per hour per user token per endpoint. By looking at the HTTP headers apparently the actual limit is 200. So, which is the correct one?
Are GET /v1/pins/1234 and GET /v1/pins/5678 considered to be a call to the same endpoint?
Are there any application level (so, despite of the used user token) rate-limit in place?
Are there any IP level rate limits?
Since we use concurrent requests, are there any limitation on the number of CONCURRENT request? (which means: make another call from the same IP and using the same token, even if the previous one hasn't ended yet)
Thanks in advance.
PS: I tried to contact them via support form, but it returns a 422. Which is awesome!
For apps that is still in development stage the limit is 200. You will get 1000 if your apps passed the review.
The documentation states that the rate limit is 1000 calls per hour
per user token per endpoint. By looking at the HTTP headers
apparently the actual limit is 200. So, which is the correct one?
Ans: Its 10 per token per app id per hour for app in development(tested), 1000 per token per hour for production app.
Are there any application level (so, despite of the used user token)
rate-limit in place?
Ans: No, rate limit will be 10(app in development) or 1000(approved app)/hour for each tokens you have
Are there any IP level rate limits?
Ans: No
Since we use concurrent requests, are there any limitation on the number of CONCURRENT request? (which means: make another call from the same IP and using the same token, even if the previous one hasn't ended yet)
Ans: No there is no such limit but they will probably check for bot activity and you may end up with banned account, so please do maintain some delay in between requests for same token IMO 12 seconds should be enough

Google Places webservice returns nextpage token as 0x0 after two requests

I have written a d code to retrieve the available places (like hospitals in US) from google places web service. I am able to retrieve place details only continuously for 2 requests only. afterwards the pagination token is set as 0x0 in the json response.
But if i manually do the search in the google then it keep on moving more than that. What is wrong am i doing here. Google says that it allows 1000 request per day limit for free. But it doesn't serve more than 2 requests. I have used d lang "requests" module for making the http request.
You only get 60 results across three pages, because that's the maximum provided by the API.
Nearby Search and Text Search requests in the Google Places API web service return a maximum of 60 results. See the Accessing Additional Results section of the documentation, which says:
each search can return as many as 60 results, split across three pages.
(Emphasis mine.)
dlang-requests can display (to stdout) detailed info on request and response if you use verbosity=3.
Also you can compile sources it with -debug=requests and set globalLogLevel(LogLevel.trace) to produce even more detailed log information. If this doesn't help, then please give me detailed info on failed API call so that I can reproduce problem.

Bing Maps API inconsistently fails on certain postal code lookups

I have an application using Bing Maps API to retrieve coordinates for a postal code and then I perform spatial queries based on the result. There are times where I get empty results, but when I wait a few minutes it succeeds. I added logic that retried a handful of times if there's a failure but that doesn't seem to be helping. Here's the empty result I get back:
{"authenticationResultCode":"ValidCredentials","brandLogoUri":"http://dev.virtualearth.net/Branding/logo_powered_by.png","copyright":"Copyright © 2014 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":0,"resources":[]}],"statusCode":200,"statusDescription":"OK","traceId":"7a6bfca3f89b4f94a4693a410da4feb7|CH10043840|02.00.107.2300|CH1SCH050102529"}
And here's the URL I'm calling:
http://dev.virtualearth.net/REST/v1/Locations?q=50613&o=json&key=MyApiKey
Is there a way I can retrieve further information based on the traceId? Or is this something that's just accepted when using Bing Maps API?
You should firstly check the number of requests you're doing in a specific time and put it in relation with the type of Bing Maps Key you're using. Basic keys are rate limited which means that if you exceed the allowed number of request in a specific duration, you will be blocked.
Bing Maps Trial and basic key and rate limitation information
Those types of key are rate limited for security and logicial reasons (on 24h period and with time between the request) and that's the reason why you're getting a blank response without any information regarding the fact that it failed to geocode.
See the Terms of Use regarding the limitations and other restrictions (load and stress tests as well as hammering are part of it): http://www.microsoft.com/maps/product/terms.html
So, in order to try to analyze where your problem comes from, you might:
Check the type of key you're using and how many calls you're making on a specific period
Check the header of the response, it should include a specific header value: X-MS-BM-WS-INFO set to 1 if you are rate limited
See the MSDN about error handling: http://msdn.microsoft.com/en-us/library/ff701703.aspx
If you're not in this case (if you have an enterprise account), reach the technical support so they can officialy get back to you and check the key.

How to send long query string in Windows Phone with HttpWebRequest

I am making an API call to Facebook, using the Facebook C# SDK, and I can't seem to send long query strings via HTTP GET. I need a long FQL query (select .. from .. where .. in ) to execute and I can't seem to send it. If the query is smaller, it does send successfully and return the results. Unfortunatelly, as FQL supports GET and not POST, I am stuck to GET.
How can I increase the default query string limit in Windows Phone HttpWebRequest?
I am using Windows Phone SDK 7.1, but testing on Windows Phone 8 device.
It seems you need to switch to http post (if possible) or optimize your request somehow.
Read What is the maximum length of a URL in different browsers?. While the official standard for HTTP says that there should be no maximum, in reality there are maximums. For example, IE have an upper bound of 2083 characters. Windows Phone seems to have similar limit to IE.
Microsoft Internet Explorer has a maximum uniform resource locator
(URL) length of 2,083 characters. Internet Explorer also has a maximum
path length of 2,048 characters. This limit applies to both POST
request and GET request URLs.
If you are using the GET method, you are limited to a maximum of 2,048
characters, minus the number of characters in the actual path.
However, the POST method is not limited by the size of the URL for
submitting name/value pairs. These pairs are transferred in the header
and not in the URL.
RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1," does not specify
any requirement for URL length.
Source: http://social.msdn.microsoft.com/Forums/en-US/wpdevelop/thread/f96622fe-4dcb-4d38-8831-4cfad1aa4a06/

Resources