Google Drive API Example - What worked for me


An interesting Java example exists for the Google Drive API on the Google Developers Site. It is located in the Quick Start menu.

It is intended to provide developers with a simple way to start using the Google Drive API.

While this is a welcome extension provided by Google, I ran into problems making this example work.

The first problem I encountered was enabling the Drive API.


The instructions indicated that you are required to "enable the Drive API". I did this, but it appears you also need to enable the Drive SDK as well. If you fail to enable both you receive an "access not configured" error.

The 2nd problem that caused me a few hours of frustration was the inability to build the example using the suggested Maven configuration.

After numerous attempts I was able to settle on this Maven configuration which appeared to work.

<dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-drive</artifactId>
      <version>v2-rev66-1.13.2-beta</version>
    </dependency>
    <dependency>
      <groupId>com.google.http-client</groupId>
      <artifactId>google-http-client-jackson2</artifactId>
      <version>1.14.1-beta</version>
    </dependency>

I agree this looks like a "hack". ( I am using different versions of the google library ). The problem I encountered was that the example was using a class from a Java package ( com.google.api.client.json.jackson2.JacksonFactory ) which I could only find in the com.google.http-client library.

I suspect there is a better approach, if so, I would be interested to know.

Or, maybe Google can update their documentation....






Comments

Popular posts from this blog

Vaadin - GRID Component

Connecting a Vaadin SQL Container to a Combo Box

Web Cam and Vaadin