The Google drive v2 seams to return a full file resource by default when I preform a file.Get. However when I make the same request against V3 even though the documentation states it should return a file resource it is only returning a partial file resource.
GET /drive/v2/files/0B5pJkOVaKccEVEsybFA2WjJjQ1k?access_token={Token}
Returns the full file
{
"mimeType": "text/plain",
"version": "416164",
"appDataContents": false,
"thumbnailLink": "https://lh3.googleusercontent.com/UE-d50Sda_j2pT1dzw8Ll1r7W2gYZNrofX2YS-VKG7Ykl4FAqe9NPPNPA3HX3PBdhQ8uow=s220",
"labels": {
"restricted": false,
"starred": false,
"viewed": false,
"hidden": false,
"trashed": false
},
"explicitlyTrashed": false,
"lastModifyingUserName": "Linda Lawton",
"writersCanShare": true,
"owners": [
{
"picture": {
"url": "https://lh5.googleusercontent.com/-a1CWlFnA5xE/AAAAAAAAAAI/AAAAAAAAdVM/sHkU9F-AwwQ/s64/photo.jpg"
},
"kind": "drive#user",
"displayName": "Linda Lawton",
"permissionId": "6030588225573437243",
"isAuthenticatedUser": true,
"emailAddress": "[email protected]"
}
],
"id": "0B5pJkOVaKccEVEsybFA2WjJjQ1k",
"lastModifyingUser": {
"picture": {
"url": "https://lh5.googleusercontent.com/-a1CWlFnA5xE/AAAAAAAAAAI/AAAAAAAAdVM/sHkU9F-AwwQ/s64/photo.jpg"
},
"kind": "drive#user",
"displayName": "Linda Lawton",
"permissionId": "06030588225573437243",
"isAuthenticatedUser": true,
"emailAddress": "[email protected]"
},
"title": "deleteme.txt",
"ownerNames": [
"Linda Lawton"
],
"etag": "\"dyf6dc5nFpQUIZ2nJvOu2LyLJk8/MTQ4MTU0MTI1NzI2MQ\"",
"parents": [
{
"isRoot": true,
"kind": "drive#parentReference",
"id": "0AJpJkOVaKccEUk9PVA",
"selfLink": "https://www.googleapis.com/drive/v2/files/0B5pJkOVaKccEVEsybFA2WjJjQ1k/parents/0AJpJkOVaKccEUk9PVA",
"parentLink": "https://www.googleapis.com/drive/v2/files/0AJpJkOVaKccEUk9PVA"
}
],
"shared": false,
"originalFilename": "deleteme.txt",
"description": "Test Description",
"webContentLink": "https://drive.google.com/uc?id=0B5pJkOVaKccEVEsybFA2WjJjQ1k&export=download",
"editable": true,
"embedLink": "https://drive.google.com/file/d/0B5pJkOVaKccEVEsybFA2WjJjQ1k/preview?usp=drivesdk",
"markedViewedByMeDate": "1970-01-01T00:00:00.000Z",
"quotaBytesUsed": "150",
"modifiedDate": "2016-12-12T11:14:17.261Z",
"createdDate": "2016-12-12T11:14:17.261Z",
"md5Checksum": "8034035d0be478ab4e4c9bed279a5ff6",
"iconLink": "https://ssl.gstatic.com/docs/doclist/images/icon_10_text_list.png",
"kind": "drive#file",
"alternateLink": "https://drive.google.com/file/d/0B5pJkOVaKccEVEsybFA2WjJjQ1k/view?usp=drivesdk",
"copyable": true,
"modifiedByMeDate": "2016-12-12T11:14:17.261Z",
"downloadUrl": "https://doc-00-38-docs.googleusercontent.com/docs/securesc/1mngaurn1r7pdnvlih02e6t9l8me2de5/5h0plr5pqk919iiraojovqrovifi85g7/1481702400000/06030588225573437243/06030588225573437243/0B5pJkOVaKccEVEsybFA2WjJjQ1k?e=download&gd=true",
"userPermission": {
"kind": "drive#permission",
"etag": "\"dyf6dc5nFpQUIZ2nJvOu2LyLJk8/-EUeXLzWA6FGgRjCErcDZHhfLzg\"",
"role": "owner",
"type": "user",
"id": "me",
"selfLink": "https://www.googleapis.com/drive/v2/files/0B5pJkOVaKccEVEsybFA2WjJjQ1k/permissions/me"
},
"spaces": [
"drive"
],
"fileExtension": "txt",
"headRevisionId": "0B5pJkOVaKccEMW0yMitzcklkaWtFZ3FIS1l6Q2x5RGpKQkNjPQ",
"selfLink": "https://www.googleapis.com/drive/v2/files/0B5pJkOVaKccEVEsybFA2WjJjQ1k",
"fileSize": "150"
}
However when I make the same request against V3
GET /drive/v3/files/0B5pJkOVaKccEVEsybFA2WjJjQ1k?access_token={Token}
It returns only partial metadata
{
"mimeType": "text/plain",
"kind": "drive#file",
"id": "0B5pJkOVaKccEVEsybFA2WjJjQ1k",
"name": "deleteme.txt"
}
I have found that by adding the fields parameter I can request additional ones from V3. however I cant seam to find a way of returning all of the fields in one request.
fields
Selector specifying a subset of fields to include in the response.
For more information, see the partial response section in the Performance Tips document. Use for better performance.
Its one get request so I am not concerned with performance I just need to see all the data for this file.
After digging around in the documentation I managed to find a comment.
Use wildcards in field selections, if needed.
For example: fields=items/pagemap/* selects all objects in a pagemap.
So I tried this.
GET /drive/v3/files/0B5pJkOVaKccEVEsybFA2WjJjQ1k?access_token={Token}&fields=*
Sure enough it returned the full File resource.
Solution was to add fields=*
to the request. Personally I think this should be default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With