list files in folder

As may devs, I want to get a list of all files in a specific folder. I have the following basic tree structure

root
   swimmer
      trainings
         test1.doc
         test2.doc
      logs
         resultsA.csv
         resultsB.csv

trying to list files in root/swimmer/trainings , I tried to use :

 GET https://www.googleapis.com/drive/v2/files/trainings/children

and tested it within https://developers.google.com/drive/v2/reference/children/list

but I get the 404 response :

404 Not Found
- Show headers -
  {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "File not found: trainings"
   }
  ],
  "code": 404,
  "message": "File not found: trainings"
 }
}

I also tried : GET https://www.googleapis.com/drive/v2/files?maxResults=10&projection=BASIC&q='trainings'+in+parents&key={YOUR_API_KEY}

same result not found ..

where am I wrong ?


Many things wrong in both your http urls. Look up the docs carefully. In #1 its not the folder name, its the folder id (or else how do you think it would know which of the possibly several folders named 'trainings' to use?)

链接地址: http://www.djcxy.com/p/66434.html

上一篇: 检测文件重命名驱动器API

下一篇: 列出文件夹中的文件