Friday, March 13, 2015
Selecting Upload Destinations with the Picker API
Drive is a great drop zone for incoming files -- no matter if they’re coming from cameras, scanners, faxes, or countless other devices or apps. But throwing files into the root folder makes it difficult for users to find and organize their content.
I’ve seen developers create a folder when the user first connects the app with Drive to keep files organized by the app that created it. It’s a simple technique that is easy to implement and good default behavior for most applications.
With the Picker API, we can go a step further and offer users the choice of destinations too. For example, I’d like my scanner to put work files in one folder and personal files in another, or even configure multiple destinations depending on the type of document I’m scanning.
For this particular use case, the picker needs to be configured to show folders and only show folders. That requires customizing the DocsView just a little.
var docsView = new google.picker.DocsView()
.setIncludeFolders(true)
.setMimeTypes(application/vnd.google-apps.folder)
.setSelectFolderEnabled(true);
By enabling folders & the ability to select them while simultaneously filtering out everything else, users can quickly and easily select one of their existing folders as a destination. The rest of the code to show the picker is par for the course.
// Handle user actions with the picker.
var callback = function(data) {
if (data.action == google.picker.Action.PICKED) {
var doc = data.docs[0];
alert("You picked " + doc.id);
}
};
var picker = new google.picker.PickerBuilder()
.addView(docsView)
.setCallback(callback)
.build();
picker.setVisible(true);
Not only is this easy to implement, it’s safer for users. By offloading this functionality to the Picker API, an app only needs the drive.file scope to write files into the user’s preferred location.
You can learn more about the Picker API at developers.google.com or ask questions at StackOverflow with the google-drive-sdk tag.
Steven Bazyl profile | twitter Steve is a Developer Advocate for Google Drive and enjoys helping developers build better apps. |
Wednesday, March 11, 2015
Get coding fast with Code School and the Google Drive API
Code School has been doing exciting things with learning to program online. This is why we decided to team up with them to create a way for developers to learn to use the Google Drive API, with no setup required. In the Discover Drive course, you can learn at your own pace from your web browser. You’ll spend less time fussing with coding environments and more time writing code.
To find out what the course is all about, go check it out at Code School. Happy coding!
Cross-posted on the Google Developers Blog.
![]() | Greg Knoke Google+ Greg Knoke is a technical writer in the Google Drive Developer Relations Team. Prior to joining Google, he worked as a scientist developing image and signal processing algorithms. His current interests include new technologies, content management, information architecture, cooking, music, and photography. |
Managing groups using the new Groups Settings API
The recently launched Groups Settings API allows Google Apps domain administrators to write client applications for managing groups in their domain. Once you have created the groups and added members using the Provisioning API, you can use the Groups Settings API to perform actions like:
- manage access to the group
- configure discussion archiving
- configure message moderation
- edit a groups description, display format and custom fields
Let’s have a look at how you can make authorized calls to the Groups Settings API from your client application.
Getting Started
You must enable the Provisioning API to make requests to the Groups Settings API. You can do so by enabling the Provisioning API checkbox in the Domain settings tab of your Google Apps control panel.

Next, ensure that the Google Groups for Business and Email services are added to your domain by going to the Dashboard. If these services are not listed, add them by going to Add more services link next to the Service settings heading.

Now you are set to write client applications. Lets discuss the steps to write an application using the Python client library. You need to install the google-api-python-client library first.
You can register a new project or use an existing one from the APIs console to obtain credentials to use in your application. The credentials (client_id
, client_secret
) are used to obtain OAuth tokens for authorization of the API requests.
Authorization using OAuth 2.0
The Groups Settings API supports various authorization mechanisms, including OAuth 2.0. Please see the wiki for more information on using the library’s support for OAuth 2.0 to create a httplib2.Http
object. This object is used by the Groups Settings service to make authorized requests.
Make API requests with GroupSettings service
The Python client library uses the Discovery API to build the Groups Settings service from discovery. The method build
is defined in the library and can be imported to build the service. The service can then access resources (‘groups’ in this case) and perform actions on them using methods defined in the discovery metadata.
The following example shows how to retrieve the properties for the group staff@example.com
.
service = build(“groups”, “v1”, http=http)
group = service.groups()
g = group.get(groupUniqueId=”staff@example.com”).execute()
This method returns a dictionary of property pairs (name/value):
group_name = g[name]
group_isArchived = g[isArchived]
group_whoCanViewGroup = g[whoCanViewGroup]
The update
method can be used to set the properties of a group. Let’s have a look at how you can set the access permissions for a group:
body = {whoCanInvite: ALL_MANAGERS_CAN_INVITE,
whoCanJoin: ‘INVITED_CAN_JOIN’,
whoCanPostMessage: ‘ALL_MEMBERS_CAN_POST’,
whoCanViewGroup: ‘ALL_IN_DOMAIN_CAN_VIEW’
}
# Update the properties of group
g1 = group.update(groupUniqueId=groupId, body=body).execute()
Additional valid values for these properties, as well as the complete list of properties, are documented in the reference guide. We have recently added a sample in the Python client library that you can refer to when developing your own application. We would be glad to hear your feedback or any queries you have on the forum.
Shraddha Gupta profile Shraddha is a Developer Programs Engineer for Google Apps. She has her MTech in Computer Science and Engineering from IIT Delhi, India. |
Tuesday, March 10, 2015
Update on Marketplace Billing API
For the next version, we’re working on making the billing features both easier to integrate with and easier for customers to use. Additional changes will enable us to innovate faster with expanded country support, payment options, and other exciting features due later on. Version 2 of the licensing API will continue to be supported throughout these changes.
Developers using the preview implementation can continue to do so until the new version is available and customers are transitioned. Those just getting started with the Marketplace are encouraged to use their own payment solution until the new version is available.
Please let us know if you have any questions by posting in the Google Apps Marketplace API forum.
Posted by Steven Bazyl, Google Apps Marketplace Team
Monday, March 9, 2015
Deprecating SWF exports of presentations in the Google Documents List API
We are announcing the deprecation of SWF export functionality for presentations from the Google Documents List API. We are taking this action due to the limited demand for this feature, and in order to focus engineering efforts on other aspects of the API.
Clients currently making the following request to the API are affected by this change.
https://docs.google.com/feeds/download/presentations/Export?docID=1234&exportFormat=swf
We recommend clients currently using SWF exports switch to PDF exports, using the appropriate exportFormat value.
https://docs.google.com/feeds/download/presentations/Export?docID=1234&exportFormat=pdf
We are disabling SWF exports in the coming weeks. Clients attempting to export presentations as SWF after the exports are disabled will receive an HTTP 400 response.
For more information on exporting presentations, see the Google Documents List API documentation. If you have any questions, feel free to reach out in the forums.
![]() | Vic Fryzel profile | twitter | blog Vic is a Google engineer and open source software developer in the United States. His interests are generally in the artificial intelligence domain, specifically regarding neural networks and machine learning. Hes an amateur robotics and embedded systems engineer, and also maintains a significant interest in the security of software systems and engineering processes behind large software projects. |
Introducing a New Version of the Email Migration API
This API is now part of our Admin SDK, which is useful for managing applications for Google Apps users through the Google APIs Console. Additionally, the Email Migration API v2 now includes support for:
- Delegated administrators
- OAuth 2.0
- Media uploads
engineering/backend-support
can be migrated with the label engineering-backend-support
to retain the previous organization structure. For more information about the API, visit the the Getting Started guide or explore the API Reference.
![]() | Greg Knoke Google+ Greg Knoke is a technical writer in the Google Drive Developer Relations Team. Prior to joining Google, he worked as a scientist developing image and signal processing algorithms. His current interests include new technologies, content management, information architecture, cooking, music, and photography. |
What does storage quota unification mean for the Drive API
The new values for quotaBytesUsed field will reflect the total amount of storage used across the unified products. (This field used to reflect the total amount of storage used by Google Drive.)
![]() | Ali Afshar profile | twitter Tech Lead, Google Drive Developer Relations. As an eternal open source advocate, he contributes to a number of open source applications, and is the author of the PIDA Python IDE. Once an intensive care physician, he has a special interest in all aspects of technology for healthcare |