Gets the information about the current user along with Drive API settings Try it now or see an example.
Request
HTTP request
GET https://www.googleapis.com/drive/v2/about
Parameters
Parameter name | Value | Description |
---|---|---|
Optional query parameters | ||
includeSubscribed |
boolean |
Whether to count changes outside the My Drive hierarchy. When set to false, changes to files such as those in the Application Data folder or shared files which have not been added to My Drive will be omitted from the maxChangeIdCount .
(Default: true )
|
maxChangeIdCount |
long |
Maximum number of remaining change IDs to count |
startChangeId |
long |
Change ID to start counting from when calculating number of remaining change IDs |
Authorization
This request requires authorization with at least one of the following scopes:
Scope |
---|
https://www.googleapis.com/auth/drive |
https://www.googleapis.com/auth/drive.file |
https://www.googleapis.com/auth/drive.readonly |
https://www.googleapis.com/auth/drive.metadata.readonly |
https://www.googleapis.com/auth/drive.appdata |
https://www.googleapis.com/auth/drive.metadata |
https://www.googleapis.com/auth/drive.photos.readonly |
Some scopes are restricted and require a security assessment for your app to use them. For more information, see the authentication and authorization page.
Request body
Do not supply a request body with this method.
Response
If successful, this method returns an About resource in the response body.
Examples
Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).
Java
Uses the Java client library.
import com.google.api.services.drive.Drive; import com.google.api.services.drive.model.About; import java.io.IOException; // ... public class MyClass { // ... /** * Print information about the current user along with the Drive API * settings. * * @param service Drive API service instance. */ private static void printAbout(Drive service) { try { About about = service.about().get().execute(); System.out.println("Current user name: " + about.getName()); System.out.println("Root folder ID: " + about.getRootFolderId()); System.out.println("Total quota (bytes): " + about.getQuotaBytesTotal()); System.out.println("Used quota (bytes): " + about.getQuotaBytesUsed()); } catch (IOException e) { System.out.println("An error occurred: " + e); } } // ... }
.NET
Uses the .NET client library.
using Google.Apis.Drive.v2; using Google.Apis.Drive.v2.Data; using System.Net; // ... public class MyClass { // ... /// <summary> /// Print information about the current user along with the Drive API /// settings. /// </summary> /// <param name="service">Drive API service instance.</param> public static void PrintAbout(DriveService service) { try { About about = service.About.Get().Execute(); Console.WriteLine("Current user name: " + about.Name); Console.WriteLine("Root folder ID: " + about.RootFolderId); Console.WriteLine("Total quota (bytes): " + about.QuotaBytesTotal); Console.WriteLine("Used quota (bytes): " + about.QuotaBytesUsed); } catch (Exception e) { Console.WriteLine("An error occurred: " + e.Message); } } // ... }
PHP
Uses the PHP client library.
/** * Print information about the current user along with the Drive API settings. * * @param Google_Service_Drive $service Drive API service instance. */ function printAbout($service) { try { $about = $service->about->get(); print "Current user name: " . $about->getName(); print "Root folder ID: " . $about->getRootFolderId(); print "Total quota (bytes): " . $about->getQuotaBytesTotal(); print "Used quota (bytes): " . $about->getQuotaBytesUsed(); } catch (Exception $e) { print "An error occurred: " . $e->getMessage(); } }
Python
Uses the Python client library.
from apiclient import errors # ... def print_about(service): """Print information about the user along with the Drive API settings. Args: service: Drive API service instance. """ try: about = service.about().get().execute() print 'Current user name: %s' % about['name'] print 'Root folder ID: %s' % about['rootFolderId'] print 'Total quota (bytes): %s' % about['quotaBytesTotal'] print 'Used quota (bytes): %s' % about['quotaBytesUsed'] except errors.HttpError, error: print 'An error occurred: %s' % error
JavaScript
Uses the JavaScript client library.
/** * Print information about the current user along with the Drive API * settings. */ function printAbout() { var request = gapi.client.drive.about.get(); request.execute(function(resp) { console.log('Current user name: ' + resp.name); console.log('Root folder ID: ' + resp.rootFolderId); console.log('Total quota (bytes): ' + resp.quotaBytesTotal); console.log('Used quota (bytes): ' + resp.quotaBytesUsed); }); }
Go
Uses the Go client library.
import ( "google.golang.org/drive/v2" "fmt" ) // PrintAbout prints information from the user's Drive account func PrintAbout(d *drive.Service) error { a, err := d.About.Get().Do() if err != nil { fmt.Printf("An error occurred: %v\n", err) return err } fmt.Printf("About: %v\n", a) fmt.Printf("Current user name: %v\n", a.Name) fmt.Printf("Root folder ID: %v\n", a.RootFolderId) fmt.Printf("Total quota (bytes): %v\n", a.QuotaBytesTotal) fmt.Printf("Used quota (bytes): %v\n", a.QuotaBytesUsed) return nil }
Objective-C
Uses the Objective-C client library.
#import "GTLDrive.h" // ... + (void)printAboutWithService:(GTLServiceDrive *)service { GTLQueryDrive *query = [GTLQueryDrive queryForAboutGet]; // queryTicket can be used to track the status of the request. GTLServiceTicket *queryTicket = [service executeQuery:query completionHandler:^(GTLServiceTicket *ticket, GTLDriveAbout *about, NSError *error) { if (error == nil) { NSLog(@"Current user name: %@", about.name); NSLog(@"Root folder ID: %@", about.rootFolderId); NSLog(@"Total quota (bytes): %@", about.quotaBytesTotal); NSLog(@"Used quota (bytes): %@", about.quotaBytesUsed); } else { NSLog(@"An error occurred: %@", error); } }]; } // ...
Try it!
Use the APIs Explorer below to call this method on live data and see the response.