Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

236
Views
why google drive does not return metadata of files which i provided in the fields parameter?

I am trying to get the Size of files with google drive API

const filesFilteredByDate = await axios.get('https://www.googleapis.com/drive/v3/files', {
   q: `mimeType = 'application/vnd.google-apps.folder'`,
    fields: 'files(id, name, size, modifiedTime)',
    orderBy: 'modifiedTime desc',
    spaces: 'drive',
    headers: {
      authorization: `Bearer ${accessToken}`
    }
  });

But it does not return the size and modified time of the folder enter image description here

So how do i get size , modifiedTime and createdTime

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Not all file types have a size. your searching for folders only folders dont return a size.

{
   "id": "1R_QjyKy27C-3ASMJJa",
   "name": "YouTube",
   "mimeType": "application/vnd.google-apps.folder",
   "modifiedTime": "2021-12-14T08:48:38.786Z"
  },

If you try a diffrent file type you will find it does return a size fore example a zip file

 {
   "id": "107GrdcfBFVuWjlMZEKN7qAqsdvsH",
   "name": "backup_2022-02-16-1013_Daimto_e3763aa68b2c-others.zip",
   "modifiedTime": "2022-02-16T08:14:16.917Z",
   "size": "17849423"
  },
about 4 years ago · Juan Pablo Isaza Report

0

Size of the folder is not provided by google drive api more id, name,kind,mimeType are the default data object

Moreover, put your fields inside params if you are using Axios just like that

const filesFilteredByDate = await axios.get('https://www.googleapis.com/drive/v3/files', {
            params: {
                q: "mimeType='application/vnd.google-apps.folder'",
                fields: "files(id,name,createdTime,modifiedTime,parents)",
                orderBy: "modifiedTime desc",
            },
            headers: {
            authorization: `Bearer ${accessToken}`
            }
        });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!