{"id":627,"date":"2015-09-06T23:39:21","date_gmt":"2015-09-06T18:39:21","guid":{"rendered":"http:\/\/128.199.176.160\/?p=627"},"modified":"2025-09-11T17:31:59","modified_gmt":"2025-09-11T12:31:59","slug":"diving-in-google-drive-apis-list-files-and-folders","status":"publish","type":"post","link":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/","title":{"rendered":"Diving in Google Drive APIs \u2013 List Files and Folders"},"content":{"rendered":"\n<p>Today, We are going to actually start playing with Google Drive APIs. Previous parts were base for&nbsp;implementation of web apps with Google APIs. In this part 3, We will use Google Drive functions and list files ,folders and display them at page.<\/p>\n\n\n\n<p>I assume you have already gone through Authentication and Installation process.&nbsp;I have shared my code at <a href=\"https:\/\/github.com\/hiddenpearls\/Google-PHP-Samples\" target=\"_blank\" rel=\"noopener\">github<\/a> where we&nbsp;are actually moving in a direction to build a simple web app where we will list our Google Drive files and perform operations etc.<\/p>\n\n\n\n<p>Following is a simple function that fetches latest 100 files from user&#8217;s Google account and show it on page. We are displaying their file titles and also their icons which represents their file types as well. For example it can be spreadsheet, image or a folder.<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/hiddenpearls\/e8c0e53d93a9db9bd3f5.js\"><\/script><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-consolusion\">Consolusion<\/h3>\n\n\n\n<p>If you see my complete web app&nbsp;files, you will see I have managed Authentication and other things in a way that these are <em><strong>VERY<\/strong><\/em> easy to understand and follow. In any case, you don&#8217;t understand or have a better idea to achieve the same thing I did, shout below in comments \ud83d\ude09<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, We are going to actually start playing with Google Drive APIs. Previous parts were base for&nbsp;implementation of web apps with Google APIs. In this part 3, We will use Google Drive functions and list files ,folders and display them at page. I assume you have already gone through Authentication and Installation process.&nbsp;I have shared [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1499,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_analytify_skip_tracking":false,"footnotes":""},"categories":[85,53],"tags":[99,103],"class_list":["post-627","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google-drive","category-how-to","tag-google-drive","tag-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Diving in Google Drive APIs \u2013 List Files and Folders - WPBrigade<\/title>\n<meta name=\"description\" content=\"We are going to actually start playing with Google Drive APIs. Previous parts were base for\u00a0implementation of web apps with Google APIs.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Diving in Google Drive APIs \u2013 List Files and Folders\" \/>\n<meta property=\"og:description\" content=\"We are going to actually start playing with Google Drive APIs. Previous parts were base for\u00a0implementation of web apps with Google APIs.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/\" \/>\n<meta property=\"og:site_name\" content=\"WPBrigade\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/WPBrigade\" \/>\n<meta property=\"article:published_time\" content=\"2015-09-06T18:39:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-11T12:31:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/google-drive-api.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Adnan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@wpbrigade\" \/>\n<meta name=\"twitter:site\" content=\"@wpbrigade\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Adnan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/\"},\"author\":{\"name\":\"Adnan\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#\\\/schema\\\/person\\\/60305aa637f786ceebbf9949f1a24634\"},\"headline\":\"Diving in Google Drive APIs \u2013 List Files and Folders\",\"datePublished\":\"2015-09-06T18:39:21+00:00\",\"dateModified\":\"2025-09-11T12:31:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/\"},\"wordCount\":199,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/google-drive-api.jpg\",\"keywords\":[\"Google Drive\",\"PHP\"],\"articleSection\":[\"Google Drive\",\"How-to\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/\",\"url\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/\",\"name\":\"Diving in Google Drive APIs \u2013 List Files and Folders - WPBrigade\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/google-drive-api.jpg\",\"datePublished\":\"2015-09-06T18:39:21+00:00\",\"dateModified\":\"2025-09-11T12:31:59+00:00\",\"description\":\"We are going to actually start playing with Google Drive APIs. Previous parts were base for\u00a0implementation of web apps with Google APIs.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/#primaryimage\",\"url\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/google-drive-api.jpg\",\"contentUrl\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/google-drive-api.jpg\",\"width\":800,\"height\":400,\"caption\":\"Google drive API, Google Drive PHP API\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/diving-in-google-drive-apis-list-files-and-folders\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wpbrigade.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Diving in Google Drive APIs \u2013 List Files and Folders\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#website\",\"url\":\"https:\\\/\\\/wpbrigade.com\\\/\",\"name\":\"WPBrigade\",\"description\":\"WordPress Development Agency\",\"publisher\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wpbrigade.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#organization\",\"name\":\"WPBrigade\",\"url\":\"https:\\\/\\\/wpbrigade.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/Screen-Shot-2021-07-02-at-12.42.14-AM.png\",\"contentUrl\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/Screen-Shot-2021-07-02-at-12.42.14-AM.png\",\"width\":271,\"height\":63,\"caption\":\"WPBrigade\"},\"image\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/facebook.com\\\/WPBrigade\",\"https:\\\/\\\/x.com\\\/wpbrigade\",\"https:\\\/\\\/www.instagram.com\\\/wpbrigade.agency\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wpbrigade\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/Wpbrigade\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#\\\/schema\\\/person\\\/60305aa637f786ceebbf9949f1a24634\",\"name\":\"Adnan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g\",\"caption\":\"Adnan\"},\"sameAs\":[\"http:\\\/\\\/adnan.pk\\\/\",\"https:\\\/\\\/x.com\\\/wpbrigade\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Diving in Google Drive APIs \u2013 List Files and Folders - WPBrigade","description":"We are going to actually start playing with Google Drive APIs. Previous parts were base for\u00a0implementation of web apps with Google APIs.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/","og_locale":"en_US","og_type":"article","og_title":"Diving in Google Drive APIs \u2013 List Files and Folders","og_description":"We are going to actually start playing with Google Drive APIs. Previous parts were base for\u00a0implementation of web apps with Google APIs.","og_url":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/","og_site_name":"WPBrigade","article_publisher":"https:\/\/facebook.com\/WPBrigade","article_published_time":"2015-09-06T18:39:21+00:00","article_modified_time":"2025-09-11T12:31:59+00:00","og_image":[{"width":800,"height":400,"url":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/google-drive-api.jpg","type":"image\/jpeg"}],"author":"Adnan","twitter_card":"summary_large_image","twitter_creator":"@wpbrigade","twitter_site":"@wpbrigade","twitter_misc":{"Written by":"Adnan","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/#article","isPartOf":{"@id":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/"},"author":{"name":"Adnan","@id":"https:\/\/wpbrigade.com\/#\/schema\/person\/60305aa637f786ceebbf9949f1a24634"},"headline":"Diving in Google Drive APIs \u2013 List Files and Folders","datePublished":"2015-09-06T18:39:21+00:00","dateModified":"2025-09-11T12:31:59+00:00","mainEntityOfPage":{"@id":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/"},"wordCount":199,"commentCount":1,"publisher":{"@id":"https:\/\/wpbrigade.com\/#organization"},"image":{"@id":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/#primaryimage"},"thumbnailUrl":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/google-drive-api.jpg","keywords":["Google Drive","PHP"],"articleSection":["Google Drive","How-to"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/","url":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/","name":"Diving in Google Drive APIs \u2013 List Files and Folders - WPBrigade","isPartOf":{"@id":"https:\/\/wpbrigade.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/#primaryimage"},"image":{"@id":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/#primaryimage"},"thumbnailUrl":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/google-drive-api.jpg","datePublished":"2015-09-06T18:39:21+00:00","dateModified":"2025-09-11T12:31:59+00:00","description":"We are going to actually start playing with Google Drive APIs. Previous parts were base for\u00a0implementation of web apps with Google APIs.","breadcrumb":{"@id":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/#primaryimage","url":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/google-drive-api.jpg","contentUrl":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/google-drive-api.jpg","width":800,"height":400,"caption":"Google drive API, Google Drive PHP API"},{"@type":"BreadcrumbList","@id":"https:\/\/wpbrigade.com\/diving-in-google-drive-apis-list-files-and-folders\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpbrigade.com\/"},{"@type":"ListItem","position":2,"name":"Diving in Google Drive APIs \u2013 List Files and Folders"}]},{"@type":"WebSite","@id":"https:\/\/wpbrigade.com\/#website","url":"https:\/\/wpbrigade.com\/","name":"WPBrigade","description":"WordPress Development Agency","publisher":{"@id":"https:\/\/wpbrigade.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpbrigade.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/wpbrigade.com\/#organization","name":"WPBrigade","url":"https:\/\/wpbrigade.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpbrigade.com\/#\/schema\/logo\/image\/","url":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-02-at-12.42.14-AM.png","contentUrl":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-02-at-12.42.14-AM.png","width":271,"height":63,"caption":"WPBrigade"},"image":{"@id":"https:\/\/wpbrigade.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/WPBrigade","https:\/\/x.com\/wpbrigade","https:\/\/www.instagram.com\/wpbrigade.agency\/","https:\/\/www.linkedin.com\/company\/wpbrigade","https:\/\/www.youtube.com\/c\/Wpbrigade"]},{"@type":"Person","@id":"https:\/\/wpbrigade.com\/#\/schema\/person\/60305aa637f786ceebbf9949f1a24634","name":"Adnan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g","caption":"Adnan"},"sameAs":["http:\/\/adnan.pk\/","https:\/\/x.com\/wpbrigade"]}]}},"_links":{"self":[{"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/posts\/627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/comments?post=627"}],"version-history":[{"count":1,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/posts\/627\/revisions"}],"predecessor-version":[{"id":317478,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/posts\/627\/revisions\/317478"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/media\/1499"}],"wp:attachment":[{"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/media?parent=627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/categories?post=627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/tags?post=627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}