I want to filter only folder info like name, id etc of google drive using Google API V3 but still it gives information of other things like pdf etc. I am looking for folder info only.
And Getting (I am getting so many things and its just subset of that, last element u can see is a pdf info which should not come, I just want folder list):
{
"kind": "drive#fileList",
"nextPageToken": "SnS3QhUEpgrO3k595Zpei78DsYX6Nu7MbOruavva2vHZyCAAiyxmAmyCvXmvJDZf3GqpfryKG8TiUg==",
"incompleteSearch": false,
"files": [
{
"kind": "drive#file",
"id": "1rbWEr5c96qiAV0oFGJhbcsXuCIzN08Pq",
"name": "Test folder",
"mimeType": "application/vnd.google-apps.folder"
},
{
"kind": "drive#file",
"id": "1_OUGARZznIekMIvJdUY92B6mcMcrev6L",
"name": "t",
"mimeType": "*/*"
},
{
"kind": "drive#file",
"id": "1fUowckXE_rjmM9n_BvJy3woTY1FGX3Ao",
"name": "t",
"mimeType": "*/*"
},
{
"kind": "drive#file",
"id": "13eozlJ55JZ19_5BE0CJ_vUudVR9y-7o_",
"name": "t",
"mimeType": "*/*"
},
{
"kind": "drive#file",
"id": "1fuPoW-q0QOHvIQmpf3Gbs4qzmBd6M89H",
"name": "Pro_React_16.pdf",
"mimeType": "application/pdf"
}
]
}
Files: list
Instead it must be specified within the query parameter q
, as featured here.
How to adapt your request?
Change
https://www.googleapis.com/drive/v3/files?supportsAllDrives=true&corpora=allDrives&includeItemsFromAllDrives=true&pageSize=1000&mimeType=application/vnd.google-apps.folder
to
https://www.googleapis.com/drive/v3/files?supportsAllDrives=true&corpora=allDrives&includeItemsFromAllDrives=true&pageSize=1000&q=mimeType%20%3D%20'application%2Fvnd.google-apps.folder'
Indeed, it is very helpful to use the Try this API, especially if after retrieving a response with the specified parameters you expand the window and have a look at the resulting cURL syntax.