lbarbosa
lbarbosa

Reputation: 2172

Compatibility problems between Google Drive Rest API, Endpoints and Google API Client

I'm using a Google Endpoints backend to access Google Drive and return content to an iOS application. For this, I'm using Google API Client and Google Drive SDK on Google Endpoints for Java. Then, I generate the client library for iOS for my Endpoints and use that, along with the Google API Client for iOS on my iOS project.

The problem I'm having is that one of my endpoints returns an object that contains Google Drive's File objects.

Everything seemed fine until I started dealing with those objects on iOS. Within the endpoints response, a Google Drive File is read in iOS by the client libraries as a GTLDriveFile as expected which is the respective class for the Google Drive SDK for iOS. However, when trying to access some of the members of the object, such as name and modifiedTime I got crashes. At first I thought this was due to the fact that I was using a cocoapod for Google API Client that was incredibly outdated (I looked at the source and saw a lot of missing fields in the class). After going through the trouble of including the Google API client in the iOS project manually (a lot of trouble due to incorrect/outdated instructions by Google) although some fields for the GTLDriveFile such as the name are now available, I still get crashes for the modifiedTime field.

After investigating, I see that the Google Drive Rest API through the API explorer returns a string for the modifiedTime:

... "kind": "drive#file", ... "modifiedTime": "2016-02-08T16:34:22.127Z", ...

However, my Google Endpoints response is returning an object

... "kind": "drive#file", ... "modifiedTime": { "value": "1454513589789", "dateOnly": false, "timeZoneShift": 0 }, ...

Because of this, my iOS GTLDriveFile class is crashing while trying to parse a string when actually it's dealing with a NSDictionary

On Endpoints, I'm using the latest versions for everything: Google API client (and dependencies) are 1.21.0 as well as the Drive Rest API v3-rev8-1.21.0. On iOS I'm using a fresh clone of the Google API Client for Objective-C

I've checked the API discovery documents for Google Drive and the modifiedTime field is supposed to be a string so I'm thinking the problem might be with Google Endpoints.

Any clue as to why Google Endpoints is not correctly converting the File object?

Upvotes: 1

Views: 117

Answers (0)

Related Questions