Alex
Alex

Reputation: 1470

How to make a Google Drive files GET request using partial response that includes exportLinks / "text/plain"?

Within the OAuth 2.0 Playground, I can make this request, and it is valid:

https://www.googleapis.com/drive/v2/files?fields=items(id,exportLinks)

However, what I want to capture is just one of the export links: "text/plain". But if I request that specific field:

https://www.googleapis.com/drive/v2/files?fields=items(exportLinks/text/plain)

I get the following error:

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

How do I specify that a partial should include "exportLinks" / "text/plain"

Upvotes: 0

Views: 325

Answers (1)

pinoyyid
pinoyyid

Reputation: 22306

You can't request a specific exportLink type. You need to request them all "items(exportLinks)" and then look for the "text/plain" property of the returned exportLinks object ("var url = exportLinks['text/plain']")

Upvotes: 1

Related Questions