Apps: get

Gets a specific app. Try it now or see an example.

Request

HTTP request

GET https://www.googleapis.com/drive/v2/apps/appId

Parameters

Parameter name Value Description
Path parameters
appId string The ID of the app.

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.apps.readonly
https://www.googleapis.com/auth/drive.metadata

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 Apps 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.App;

import java.io.IOException;

// ...

public class MyClass {

  // ...

  /**
   * Print an app's metadata.
   *
   * @param service Drive API service instance.
   * @param appId ID of the file to print metadata for.
   */
  private static void printApp(Drive service, String appId) {

    try {
      App app = service.apps().get(appId).execute();

      System.out.println("Name: " + app.getName());
      System.out.println("Object type: " + app.getObjectType());
      System.out.println("Product URL: " + app.getProductUrl());
    } 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 an app's metadata.
  /// </summary>
  /// <param name="service">Drive API service instance.</param>
  /// <param name="appId">ID of the app to print metadata for.</param>
  public static void printApp(DriveService service, String appId) {
    try {
      App app = service.Apps.Get(appId).Execute();

      Console.WriteLine("Name: " + app.Name);
      Console.WriteLine("Object type: " + app.ObjectType);
      Console.WriteLine("Product URL: " + app.ProductUrl);
    } catch (Exception e) {
      Console.WriteLine("An error occurred: " + e.Message);
    }
  }

  // ...

}

PHP

Uses the PHP client library.

/**
 * Print an app's metadata.
 *
 * @param Google_Service_Drive $service Drive API service instance.
 * @param string $appId ID of the app to print metadata for.
 */
function printApp($service, $appId) {
  try {
    $app = $service->apps->get($appId);

    print "Name: " . $app->getName();
    print "Object type: " . $app->getObjectType();
    print "Product URL: " . $app->getProductUrl();
  } catch (Exception $e) {
    print "An error occurred: " . $e->getMessage();
  }
}

Python

Uses the Python client library.

from apiclient import errors
# ...

def print_app(service, app_id):
  """Print an app's metadata.

  Args:
    service: Drive API service instance.
    app_id: ID of the app to print metadata for.
  """
  try:
    file = service.apps().get(appId=app_id).execute()

    print 'Name: %s' % app['name']
    print 'Object type: %s' % app['objectType']
    print 'Product URL: %s' % app['productUrl']
  except errors.HttpError, error:
    print 'An error occurred: %s' % error

Go

Uses the Go client library.

import (
  "google.golang.org/drive/v2"
  "fmt"
)

// PrintApp fetches and displays information about the given app.
func PrintApp(d *drive.Service, appId string) error {
  f, err := d.Apps.Get(appId).Do()
  if err != nil {
    fmt.Printf("An error occurred: %v\n", err)
    return err
  }
  fmt.Printf("Name: %v", f.Name)
  fmt.Printf("Object type: %v", f.ObjectType)
  fmt.Printf("Product URL: %v", f.ProductUrl)
  return nil
}

JavaScript

Uses the JavaScript client library.

/**
 * Print an app's metadata.
 *
 * @param {String} appId ID of the app to print metadata for.
 */
function printApp(appId) {
  var request = gapi.client.drive.apps.get({
    'appId': appId
  });
  request.execute(function(resp) {
    console.log('Name: ' + resp.name);
    console.log('Object type: ' + resp.objectType);
    console.log('Product URL: ' + resp.productUrl);
  });
}

Objective-C

Uses the Objective-C client library.

#import "GTLDrive.h"
// ...

+ (void)printAppMetadataWithService:(GTLServiceDrive *)service
                              appId:(NSString *)appId {
  GTLQuery *query = [GTLQueryDrive queryForAppsGetWithAppId:appId];

  // queryTicket can be used to track the status of the request.
  GTLServiceTicket *queryTicket =
    [service executeQuery:query
        completionHandler:^(GTLServiceTicket *ticket, GTLDriveApp *app,
                            NSError *error) {
        if (error == nil) {
          NSLog(@"Name: %@", app.name);
          NSLog(@"Object type: %@", app.objectType);
          NSLog(@"Product URL: %@", app.productUrl);
        } else {
          NSLog(@"An error occurred: %@", error);
        }
      }];
}

Try it!

Use the APIs Explorer below to call this method on live data and see the response.