Google Drive Service Account change filename usin API Request - google-drive-api

I'm trying to perform next API call using PATCH method on a file that is not in a root directory,
API Call for changing the file name (Picture)
The Response (Picture)
The response of above API Call is a File resource with 200 status code, but the file name doesn't changed ;(
I have tried using API v2 and API v3, unfortunately the response is the same. File Name is not changed. For v3 i have used request body {"name": "New Name"}.
Some help please ?
I'm not interested to use any library for perform this call. I'm interested in raw API Call.
Another API Calls for manipulating with files/folders works like expected. Only this call is not working for me.
Sorry for my English,
Thanks in advance.

Related

Get zip from googleapi autocomplete request

I am sending the following request to the google autocomplete api in attempts to get a street address with the zip code included.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=917&component=country:us&key=[MyApiKey]&types=address&bounds=defaultBounds&stricktBounds=true&address_components=postal_code&fields=address_components
I can't seem to figure out how to ask for the zip code in the query parameters. When I pass a full address with the zip in the input, google returns the zip code, but I would like it to always return the zip code.
I can make another request to the google maps api and pass the place id that I get from the autocomplete endpt and get the full address with the following request.
https://maps.googleapis.com/maps/api/place/details/json?fields=formatted_address&place_id=Eic1MDEgQ29sbGVnZSBBdmVudWUsIEdyZWVuc2Jvcm8sIE5DLCBVU0EiURJPCjQKMgldGdoYQBlTiBEjv0Tw4tNAARoeCxDuwe6hARoUChIJVXM4RSQZU4gRLNRdpst7vxAMEPUDKhQKEgmVWLxpQBlTiBGKDjnnY2NAzg&key=[my_Key]
But I would like to do a search and get the zip code all in one request.
Edit:
The following works in javascript with the google api javascript package, but I cannot use javascript in my project...
https://maps.googleapis.com/maps/api/place/js/AutocompletionService.GetPredictions?1s501&fields=formatted_address&key=[my_key]
Thanks for any help!!
The google api place textsearch endpoint can be used instead with field type formatted_address to return the zip code.
https://maps.googleapis.com/maps/api/place/textsearch/json?query=971&fields=formatted_address&inputtype=textquery&key=[my_key]

Do Google Maps APIs also accept HTTP POST requests?

I am very new to web development and using any google services api.
I know I can send HTTP GET with the following format:
http://maps.googleapis.com/maps/api/geocode/json?address=CA
I am reading the documentation and it seems that it only talks about HTTP GET requests:
https://developers.google.com/maps/web-services/overview
Does anyone have any experience sending HTTP POST request to google maps apis or it is just not accepted?
Based on the Google Maps API documentation https://developers.google.com/maps/web-services/overview you don't have the option to send POST requests but only GET.
Now as your post doesn't provide more infos on how you tried to do it, my suggestion is to create a middleware that will handle those requests.
This is kinda of onverengineering as the parameters will still appear to the user if you are trying to redirect them but it will be a good case if you don't.
You can create a simple node.js middleware that will have a POST API that you'll send the data the way you want and within this request in the middleware you will transform the data and send them with a GET method to the Gmaps Api.
You can use Express to create a middleware without a lot of effort.
You can read more here: https://expressjs.com/en/guide/writing-middleware.html

Record all request uris/methods/response codes for Google Drive Java Client Library

I'm using the google client library to access the Google Drive API. I'd like to custom log all the request URI's, the request method as well as the response codes. Is there a built in mechanism to do this with the google client library?
Ideally, I could use the API as I am now and not have to modify each request but maybe add some sort of interceptor to the Drive object itself where I can record this data on every request that goes through this Drive service.
Any ideas?
Not sure that is exactly what you want but you could modify the log level of the API client in logging.properties
com.google.api.client.level = FINEST

How to set the creation date on Google Drive SDK

I have a file created a while ago that I want to upload on Google Drive, while preserving it's original creation date.
How to do that with the Google Drive SDK?
The API reference says that the createdDate JSON property is not writable. But in at least the JAVA library, you have a method setCreatedDate() that can be use to set this property to your convenience.
However, I've just tried to do that with the API explorer, and the API returned me a 400 error - Bad request. So i think this is not possible
Jérôme

Access the Google Maps API within Powershell

I try to program a name generator script for various sample data entry jobs. What I need to do is the following:
Access the Google Maps Api and give me a random adress (in a specific city if possible)
Return Street and Zip Code (and City (see above))
Is that possible in Powershell? I was thinking about using the IE ComObj and just parse the dom of Google Maps but that seems so wasteful.
Any help would be great! Thanks :)
I'm not familiar with the Google maps API however it looks like you are just calling web services.
You can interact with web services in PowerShell. If the service communicates with SOAP you can use the New-WebServiceProxy cmdlet. If it is a REST service you can use the System.Net.WebRequest .NET class, here's an example. As noted in the linked answer, you will probably want a JSON library to process the service response. Also, this fella posted a JSON module on PoshCode that you might want to take a look at.
Also, a new cmdlet is being introduced in PowerShell V3 Invoke-RestMethod, which is currently in community technical preview...
Google map provides REST API's to use them in Powershell, you can call these using an Invoke-RestMethod cmdlet to get your task done. Infact I wrote a Googlemaps module in powershell and you can get the same from Powershell Gallery