user3933324
user3933324

Reputation: 143

Agument list files API call with createdTime attribute in Google Drive API

I'd like to retrieve all the resources (files and folder) via the Files: list API call with the createdTime attribute included.

Standard response doesn't include the createdTime key described in the resource representation so I've added the fields query parameter with the value createdTime (there's an open issue related which says so but referring to API v2 while I'm using API v3).

API call I'm doing is the following:

https://www.googleapis.com/drive/v3/files?fields=createdTime

with proper authentication.

A 400 status code response is returned with the following body:

{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "invalidParameter",
                "message": "Invalid field selection createdTime",
                "locationType": "parameter",
                "location": "fields"
            }
        ],
        "code": 400,
        "message": "Invalid field selection createdTime"
    }
}

What's the correct way of using the fields query parameter?

Upvotes: 0

Views: 534

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116868

If you want to see the full response you can do the following test here

https://www.googleapis.com/drive/v3/files?fields=*

If you just want the create date you can also do test here

https://www.googleapis.com/drive/v3/files?fields=files(createdTime)

You can read more about this in Partial response

Upvotes: 1

Related Questions