Lists a user's installed apps. Try it now or see an example.
Request
HTTP request
GET https://www.googleapis.com/drive/v2/apps
Parameters
Parameter name | Value | Description |
---|---|---|
Optional query parameters | ||
appFilterExtensions |
string |
A comma-separated list of file extensions for open with filtering. All apps within the given app query scope which can open any of the given file extensions will be included in the response. If appFilterMimeTypes are provided as well, the result is a union of the two resulting app lists.
|
appFilterMimeTypes |
string |
A comma-separated list of MIME types for open with filtering. All apps within the given app query scope which can open any of the given MIME types will be included in the response. If appFilterExtensions are provided as well, the result is a union of the two resulting app lists.
|
languageCode |
string |
A language or locale code, as defined by BCP 47, with some extensions from the Unicode LDML format. |
Authorization
This request allows authorization with the following scope:
Scope |
---|
https://www.googleapis.com/auth/drive.apps.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 a response body with the following structure:
{ "kind": "drive#appList", "etag": etag, "selfLink": string, "items": [ apps Resource ], "defaultAppIds": [ string ] }
Property name | Value | Description | Notes |
---|---|---|---|
kind |
string |
This is always drive#appList. | |
etag |
etag |
The ETag of the list. | |
selfLink |
string |
A link back to this list. | |
items[] |
list |
The list of apps. | |
defaultAppIds[] |
list |
List of app IDs that the user has specified to use by default. The list is in reverse-priority order (lowest to highest). |
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.App; import com.google.api.services.drive.model.AppList; import java.io.IOException; import java.util.List; // ... public class MyClass { // ... /** * Retrieve a list of App resources. * * @param service Drive API service instance. * @return List of App resources. */ private static List<App> retrieveAllApps(Drive service) throws IOException { try { AppList apps = service.apps().list().execute(); return apps.getItems(); } catch (IOException e) { System.out.println("An error occurred: " + e); } return null; } // ... }
.NET
Uses the .NET client library.
using Google.Apis.Drive.v2; using Google.Apis.Drive.v2.Data; using System.Collections.Generic; // ... public class MyClass { // ... /// <summary> /// Retrieve a list of App resources. /// </summary> /// <param name="service">Drive API service instance.</param> /// <returns>List of App resources.</returns> public static IList<App> retrieveAllApps(DriveService service) { try { AppList apps = service.Apps.List().Execute(); return apps.Items; } catch (Exception e) { Console.WriteLine("An error occurred: " + e.Message); } return null; } // ... }
PHP
Uses the PHP client library.
/** * Retrieve a list of App resources. * * @param Google_Service_Drive $service Drive API service instance. * @return Array List of Google_Service_Drive_App resources. */ function retrieveAllApps($service) { try { $apps = $service->apps->listApps(); return $apps->getItems(); } catch (Exception $e) { print "An error occurred: " . $e->getMessage(); } return NULL; }
Python
Uses the Python client library.
from apiclient import errors # ... def retrieve_all_apps(service): """Retrieve a list of App resources. Args: service: Drive API service instance. Returns: List of App resources. """ try: apps = service.apps().list().execute() return apps.get('items', []) except errors.HttpError, error: print 'An error occurred: %s' % error return None
Go
Uses the Go client library.
import ( "google.golang.org/drive/v2" "fmt" ) // AllApps fetches all apps func AllApps(d *drive.Service) ([]*drive.App, error) { r, err := d.Apps.List().Do() if err != nil { fmt.Printf("An error occurred: %v\n", err) return nil, err } return r.Items, nil }
JavaScript
Uses the JavaScript client library.
/** * Retrieve a list of App resources. * * @param {Function} callback Function to call when the request is complete. */ function retrieveAllApps(callback) { var request = gapi.client.drive.apps.list(); request.execute(function(resp) { callback(resp.items); }); }
Objective-C
Uses the Objective-C client library.
#import "GTLDrive.h" // ... + (void)retrieveAllAppsWithService:(GTLServiceDrive *)service completionBlock:(void (^)(NSArray *, NSError *))completionBlock { GTLQueryDrive *query = [GTLQueryDrive queryForAppsList]; // queryTicket can be used to track the status of the request. GTLServiceTicket *queryTicket = [service executeQuery:query completionHandler:^(GTLServiceTicket *ticket, GTLDriveAppList *apps, NSError *error) { if (error == nil) { completionBlock(apps.items, nil); } else { NSLog(@"An error occurred: %@", error); completionBlock(nil, error); } }]; } // ...
Try it!
Use the APIs Explorer below to call this method on live data and see the response.