Google Code offered in: 中文 - English - Português - Pусский - Español - 日本語
Last updated December 9, 2007 (see recent changes)
This document provides detailed reference documentation for the Google Apps Provisioning API.
Note: The Provisioning API is only available to Google Apps Premier Edition and Google Apps Education Edition customers. To enable the API, log in to your admin account, and click the User accounts tab. Then click the Settings subtab to enable the API, select the checkbox to enable the Provisioning API and save your changes. (You will need to complete the steps for setting up Google Apps before you can log in to your admin account.)
(Google will continue to support customers who already implemented version 1.0 of the Provisioning API. However, new customers must implement version 2.0 of the API.)
Google Apps allows website administrators to offer a variety of personalized and co-branded Google applications, such as Gmail. This document describes the Google Apps Provisioning API, which enables application developers to programmatically enable access to these applications. Specifically, the API provides functions for creating, retrieving, updating and deleting user accounts, nicknames and email groups.
It's a reference document; it assumes that you understand the concepts presented in the Developer's Guide, and the general ideas behind the Google data APIs protocol.
To execute an operation using the API, you need to submit an HTTP POST, GET, PUT or DELETE request to the URL that corresponds to the operation that you wish to perform. Each URL includes variables that identify your domain and, possibly, the resource that you are creating, retrieving, updating or deleting. For example, to retrieve information about the us-sales group in the example.com domain, you would submit an HTTP GET request to the following URL:
https://apps-apis.google.com/a/feeds/group/2.0/example.com/us-sales
The tables in the subsections below identify the URLs associated with each API operation. The tables also identify the type of HTTP request associated with each API request.
All create and update requests – POST and PUT requests – also require you to submit an XML document that contains the information needed to fulfill the request. The content should be sent using the application/atom+xml content type. The XML Request Formats section in the Developer's Guide explains those XML structures and provides samples for each.
Note: If your query rate for provisioning requests is too high, you might receive HTTP 503 responses from the API server indicating that your quota has been exceeded. If you get these responses, use an exponential back-off algorithm to retry your requests (with examples of how to do exopnential backoff). For best results, parallelize operations across different groups, rather than adding or removing lots of members to one group simultaneously.
Operation | HTTP Request Type and URL |
---|---|
Create User Account | POST https://apps-apis.google.com/a/feeds/domain/user/2.0 |
Retrieve User Account | GET https://apps-apis.google.com/a/feeds/domain/user/2.0/userName |
Retrieve All Users in Domain | GET https://apps-apis.google.com/a/feeds/domain/user/2.0 |
Update User Account | PUT https://apps-apis.google.com/a/feeds/domain/user/2.0/userName |
Delete User Account | DELETE https://apps-apis.google.com/a/feeds/domain/user/2.0/userName |
Operation | HTTP Request Type and URL |
---|---|
Create Nickname | POST https://apps-apis.google.com/a/feeds/domain/nickname/2.0 |
Retrieve Nickname | GET https://apps-apis.google.com/a/feeds/domain/nickname/2.0/nickname |
Retrieve All Nicknames for a User | GET https://apps-apis.google.com/a/feeds/domain/nickname/2.0?username=userName |
Retrieve All Nicknames in Domain | GET https://apps-apis.google.com/a/feeds/domain/nickname/2.0 |
Delete Nickname | DELETE https://apps-apis.google.com/a/feeds/domain/nickname/2.0/nickname |
Operation | HTTP Request Type and URL |
---|---|
Create Group | POST https://apps-api.google.com/a/feeds/group/2.0/domain |
Update Group | PUT https://apps-api.google.com/a/feeds/group/2.0/domain/groupId |
Retrieve Group | GET https://apps-apis.google.com/a/feeds/group/2.0/domain/groupId |
Retrieve All Groups in Domain | GET https://apps-apis.google.com/a/feeds/group/2.0/domain |
Retrieve All Groups for a Member | GET https://apps-apis.google.com/a/feeds/group/2.0/domain/?member=memberId[&[directOnly=]] |
Delete Group | DELETE https://apps-apis.google.com/a/feeds/group/2.0/domain/groupId |
Create Email List | POST https://apps-apis.google.com/a/feeds/domain/emailList/2.0 (Deprecated) |
Retrieve Email List | GET https://apps-apis.google.com/a/feeds/domain/emailList/2.0/emailListName (Deprecated) |
Retrieve All Email Lists in Domain | GET https://apps-apis.google.com/a/feeds/domain/emailList/2.0 (Deprecated) |
Retrieve All Email List Subscriptions for an Email Address | GET https://apps-apis.google.com/a/feeds/domain/emailList/2.0?recipient=emailAddress (Deprecated) |
Delete Email List | DELETE https://apps-apis.google.com/a/feeds/domain/emailList/2.0/emailListName (Deprecated) |
Operation | HTTP Request Type and URL |
---|---|
Add Member to Group | POST https://apps-apis.google.com/a/feeds/group/2.0/domain/groupId/member |
Retrieve All Members of a Group | GET https://apps-apis.google.com/a/feeds/group/2.0/domain/groupId/member |
Retrieve Member of a Group | GET https://apps-apis.google.com/a/feeds/group/2.0/domain/groupId/member/memberId |
Remove Member from Group | DELETE https://apps-apis.google.com/a/feeds/group/2.0/domain/groupId/member/memberId |
Add Address to Email List | POST https://apps-apis.google.com/a/feeds/domain/emailList/2.0/emailListName/recipient/ (Deprecated) |
Retrieve All Subscribers to Email List | GET https://apps-apis.google.com/a/feeds/domain/emailList/2.0/emailListName/recipient/ (Deprecated) |
Remove Address from Email List | DELETE https://apps-apis.google.com/a/feeds/domain/emailList/2.0/emailListName/recipient/emailAddress (Deprecated) |
Operation | HTTP Request Type and URL |
---|---|
Add Owner to Group | POST http://apps-apis.google.com/a/feeds/group/2.0/domain/groupId/owner |
Retrieve All Owners of a Group | GET http://apps-apis.google.com/a/feeds/group/2.0/domain/groupId/owner |
Retrieve Owner of a Group | GET http://apps-apis.google.com/a/feeds/group/2.0/domain/groupId/owner/ownerEmail |
Remove Owner from Group | DELETE http://apps-apis.google.com/a/feeds/group/2.0/domain/groupId/owner/ownerEmail |
If your API request produces a UserFeed, NicknameFeed, Property name response, the Provisioning API will return an Atom XML feed containing a maximum of 100 entries. If there are more than 100 entries in the feed, the API response will contain an <atom:link> tag for which the rel attribute has a value of next. The URL identified in that <atom:link> tag points to the next page of results for the request. If your API request produces a GroupFeed, MemberFeed, or OwnersFeed, the Provisioning API will return an Atom XML feed containing a maximum of 200 entries.
In the XML excerpt below, the <atom:link> tag that identifies the next page of results is highlighted in bold text:
<?xml version="1.0" encoding="UTF-8"?> <atom:feed xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gd="http://schemas.google.com/g/2005"> <atom:id> https://apps-apis.google.com/a/feeds/example.com/user/2.0 </atom:id> <atom:updated>1970-01-01T00:00:00.000Z</atom:updated> <atom:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/apps/2006#user"/> <atom:title type="text">Users</atom:title> <atom:link rel="next" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/example.com/user/2.0?startUsername=john"/> <atom:link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/example.com/user/2.0"/> ...
The time to complete requests to retrieve all users, nicknames, groups, members, or owners of a group will directly relate to the amount of data being retrieved. For example, if a group has 100 subscribers, the client library can obtain a complete subscriber list with a single HTTP request. However, if a group has 1,000 members, you must make 5 HTTP requests to obtain the full member list.
Note:If your API request produces a GroupFeed, MemberFeed, or OwnersFeed, the Provisioning API will return an Atom XML feed containing a maximum of 200 entries.
If you are using the Java, .NET, PHP, or Python client library, the code provides you with the option of explicitly requesting additional pages of results or automatically requesting additional results until all results have been obtained. For example, the retrievePageOfUsers method makes a single HTTP request for up to 100 users or (200 group members), and the retrieveAllUsers method will automatically issue additional HTTP requests until all results have been obtained.
If you write your own code to process API responses, you will need to ensure that your code requests additional pages of results as necessary.
This section contains definitions of the XML tags used in Provisioning API requests and responses.
Certain symbols may be displayed next to some subtags in the definitions below. These symbols, and their meanings, are:
atom:feed | |
---|---|
Definition | The <atom:feed> tag encapsulates an API response to a request to retrieve either all of the nicknames associated with an account or all of the email groups that an account subscribes to. |
Example | <atom:feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"> |
Subtags | atom:id, atom:category, atom:link, openSearch:startIndex, openSearch:itemsPerPage, atom:entry |
Content Format | Container |
atom:entry | |
---|---|
Definition | The <atom:entry> encapsulates an API request or an API Atom response. |
Subtags | atom:id, atom:category, atom:title, atom:link, apps:login, apps:name, apps:property name gd:feedLink, gd:who |
Content Format | Container |
atom:category | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Definition | The <atom:category> tag specifies the type of resource that is described in an Atom request or response. |
|||||||||||||||||
Attributes |
|
|||||||||||||||||
Subtag of | atom:entry | |||||||||||||||||
Content Format | Empty |
atom:title | |||||||
---|---|---|---|---|---|---|---|
Definition | The <atom:title> tag value describes an API response. |
||||||
Attributes |
|
||||||
Example | <atom:title type="text">SusanJones-1321</atom:title> | ||||||
Subtag of | atom:entry | ||||||
Content Format | Complex |
atom:id | |
---|---|
Definition | The <atom:id> tag's value identifies a permanent, unique identifier for a feed. This tag is included in API responses. It may also be included in requests to update user accounts. When you include this tag in API requests, the tag's value should be set to the URL to which you submit your API request. |
Example | <atom:id>https://apps-apis.google.com/a/feeds/group/2.0/example.com/us-sales</atom:id> |
Subtag of | atom:entry |
Content Format | String (IRI) |
atom:link | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Definition | The <atom:link> tag provides an IRI reference related to an API results feed or a resource in the feed. |
|||||||||
Attributes |
|
|||||||||
Example | <atom:link rel="edit" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/group/2.0/example.com/us-sales"/> | |||||||||
Subtag of | atom:entry | |||||||||
Content Format | Empty |
atom:updated | |
---|---|
Definition | The <atom:updated> tag identifies the date and time that an entry in an Atom feed was updated. This tag is included in Provisioning API responses so that those responses conform with the Atom specification. However, the value of the <atom:updated> tag will always be a date in 1970 and the value does not serve a function in Provisioning API responses. |
Example | <atom:updated>1970-01-01T00:00:00.000Z</atom:updated> |
Subtag of | atom:feed, atom:entry |
Content Format | Date |
apps:emailList (Deprecated) | |||||||
---|---|---|---|---|---|---|---|
Definition | The <apps:emailList> tag specifies a group. |
||||||
Attributes |
|
||||||
Example | <apps:emailList="us-sales"/> | ||||||
Subtag of | atom:entry | ||||||
Content Format | Complex |
apps:login | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Definition | The <apps:login> tag specifies the username, and possibly the password, associated with a user account. |
||||||||||||||||||||||||
Attributes |
|
||||||||||||||||||||||||
Example | <apps:login userName="SusanJones" suspended="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/> | ||||||||||||||||||||||||
Subtag of | atom:entry | ||||||||||||||||||||||||
Content Format | Complex |
apps:name | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Definition | The <apps:name> tag specifies the account owner's first name and last name. First and last names may contain spaces, letters (a-z), numbers (0-9), dashes (-), forward slashes (/) and periods(.). |
|||||||||
Attributes |
|
|||||||||
Example | <apps:name familyName="Jones" givenName="Susan"/> | |||||||||
Subtag of | atom:entry | |||||||||
Content Format | Complex |
apps:nickname | |||||||
---|---|---|---|---|---|---|---|
Definition | The <apps:nickname> tag specifies a nickname. |
||||||
Attributes |
|
||||||
Example | <apps:nickname name="Jones"/> | ||||||
Subtag of | atom:entry | ||||||
Content Format | Complex |
apps:property | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Definition | The <apps:property> tag specifies information about groups or members associated with an API response. For example, when you retrieve information about a group, the API response might contain several |
|||||||||
Attributes |
|
apps:quota | |||||||
---|---|---|---|---|---|---|---|
Definition | The <apps:quota> tag specifies the amount of disk space that should be allocated to a user account. By default, Google allocates 2GB of disk space to each user account.
|
||||||
Attributes |
|
||||||
Example | <apps:quota limit="2048"/> | ||||||
Subtag of | atom:entry | ||||||
Content Format | Complex |
gd:feedLink | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Definition | The <gd:feedLink> tag contains information about a logically nested feed associated with an API response. For example, when you retrieve information about a user account, the API response contains two <gd:feedLink> tags. One tag contains information about a feed of nicknames associated with the retrieved account. The other tag contains information about a feed of groups that the account is subscribed to. |
|||||||||
Attributes |
|
|||||||||
Example | <gd:feedLink rel="http://schemas.google.com/apps/2006#user.groups" href="https://apps-apis.google.com/a/feeds/group/2.0/example.com/?recipient=us-sales@example.com"/> | |||||||||
Subtag of | atom:entry | |||||||||
Content Format | Complex |
gd:who | |||||||
---|---|---|---|---|---|---|---|
Definition | The <gd:who> tag identifies a person associated with an API response. This tag is used in API requests to add a person to a group as well as in API responses to requests to update or retrieve a group. |
||||||
Attributes |
|
||||||
Example | <gd:who email="SusanJones-1321@example.com"/> | ||||||
Subtag of | atom:entry | ||||||
Content Format | Complex |
openSearch:startIndex | |
---|---|
Definition | The <openSearch:startIndex> value identifies the one-based index of the first item returned in the result. |
Example | <openSearch:startIndex>1</openSearch:startIndex> |
Subtag of | atom:feed |
Content Format | Integer |
openSearch:itemsPerPage | |
---|---|
Definition | The <openSearch:itemsPerPage> value indicates the total number of items included in the API response. |
Example | <openSearch:itemsPerPage>10</openSearch:itemsPerPage> |
Subtag of | atom:feed |
Content Format | Integer |
AppsForYourDomainErrors | |
---|---|
Definition | The <AppsForYourDomainErrors> tag encapsulates a list of <error> tags explaining why an API request failed. |
Example | <AppsForYourDomainErrors> |
Subtags | error |
Content Format | Container |
error | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Definition | The <error> tag contains information explaining why Google failed to execute an API request. |
||||||||||||
Attributes |
|
||||||||||||
Example | <error errorCode="1301" reason="EntityDoesNotExist" invalidInput="Some-Nonexistent-User"/> | ||||||||||||
Subtag of | AppsForYourDomainErrors | ||||||||||||
Content Format | Complex |
The following list (ordered by error code number) explains the different error codes that you may receive in a Google Apps XML response.
UnknownError(1000) - The request failed for an unknown reason.
ServerBusy(1001) - The server is busy and it could not complete the request.
UserDeletedRecently(1100) - The request instructs Google to create a new user but uses the username of an account that was deleted in the previous five days.
UserSuspended(1101) - The user identified in the request is suspended.
DomainUserLimitExceeded(1200) - The specified domain has already reached its quota of user accounts.
DomainAliasLimitExceeded(1201) - The specified domain has already reached its quota of aliases. Aliases include nicknames and email lists.
DomainSuspended(1202) - Google has suspended the specified domain's access to Google Apps.
DomainFeatureUnavailable(1203) - This particular feature is not available for the specified domain.
EntityExists(1300) - The request instructs Google to create an entity that already exists.
EntityDoesNotExist(1301) - The request asks Google to retrieve an entity that does not exist.
EntityNameIsReserved(1302) - The request instructs Google to create an entity with a reserved name, such as "abuse" or "postmaster".
EntityNameNotValid(1303) - The request provides an invalid name for a requested resource.
InvalidGivenName(1400) - The value in the API request for the user's first name, or given name, contains unaccepted characters. Learn more about accepted characters for this field.
InvalidFamilyName(1401) - The value in the API request for the user's surname, or family name, contains unaccepted characters. Learn more about accepted characters for this field.
InvalidPassword(1402) - The value in the API request for the user's password contains an invalid number of characters or unaccepted characters. Learn more about accepted characters for this field.
InvalidUsername(1403) - The value in the API request for the user's username contains unaccepted characters. Learn more about accepted characters for this field.
InvalidHashFunctionName(1404) - The specified query parameter value is not valid.
InvalidHashDigestLength(1405) - The specified password does not comply with the specified hash function.
InvalidEmailAddress(1406) - The specified email address is not valid.
InvalidQueryParameterValue(1407) - The specified query parameter value is not valid.
InvalidSsoSigningKey(1408) - The specified signing key is not valid.
TooManyRecipientsOnEmailList(1500) - The request instructs Google to add users to an email list, but that list has already reached the maximum number of subscribers (1000).
TooManyNicknamesForUser(1501) - The request instructs Google to add a nickname to an email address, but that email address has already reached the maximum number of nicknames.
DuplicateDestinations(1601) - The destination specified has already been used.
TooManyDestinations(1602) - The maximum number of destinations has been reached.
InvalidRouteAddress(1603) - The routing address specified is invalid.
GroupCannotContainCycle(1700) - A group cannot contain a cycle.
InvalidDomainEdition(1800) - The domain edition is not valid.
InvalidValue(1801) - An value specified is not valid.
The following table lists the function, input parameters, and return values for the GDATA Provisioning API.
Function | Input Parameters | Return Value |
---|---|---|
createUser | String username String givenName String familyName String password String passwordHashFunction (optional) Integer quotaLimitInMB (optional) |
UserEntry |
retrieveUser | String username | UserEntry |
retrieveAllUsers | None | UserFeed |
retrievePageOfUsers | String startUsername | UserFeed |
updateUser | String username UserEntry userEntry |
UserEntry |
suspendUser | String username | UserEntry |
restoreUser | String username | UserEntry |
deleteUser | String username | None |
createNickname | String username String nickname |
NicknameEntry |
retrieveNickname | String nickname | NicknameEntry |
retrieveNicknames (for a user) | String username | NicknameFeed |
retrieveAllNicknames (in a domain) | None | NicknameFeed |
retrievePageOfNicknames (in a domain) | String startNickname | NicknameFeed |
deleteNickname | String nickname | None |
createGroup | String groupId | GroupEntry |
retrieveGroup | String recipient | GroupFeed |
retrieveAllGroups | None | GroupFeed |
deleteGroup | String groupId | None |
AddMemberToGroup | String memberId, String groupId | UserEntry |
IsMember | String memberId, String groupId | Boolean |
addMemberToGroup | String recipientAddress, String groupId | MemberEntry |
RemoveMemberFromGroup | String memberId, String groupId | MemberEntry |
RetrieveAllMembers | String memberId, String groupId | MemberFeed |
AddOwnerToGroup | String email, String groupId | OwnerEntry |
RetrieveGroupOwners | String groupId | OwnerFeed |
IsOwner | String email, String groupId | Boolean |
RemoveOwnerFromGroup | String email, String groupId | OwnerEntry |
deleteEmailList(Deprecated) | String emailList | None |
retrieveEmailLists (Deprecated) (for a user) | String recipient | EmailListFeed |
retrieveAllEmailLists (Deprecated) | None | EmailListFeed |
retrievePageOfEmailLists (Deprecated) | String startEmailListName | EmailListFeed |
addRecipientToEmailList (Deprecated) | String recipientAddress, String emailList | EmailListRecipientEntry |
retrieveAllRecipients (Deprecated) | String emailList | EmailListRecipientFeed |
retrievePageOfRecipients (Deprecated) | String emailList, String startRecipient | EmailListRecipientFeed |
removeRecipientFromEmailList (Deprecated) | String recipientAddress String emailList |
None |
createEmailList (Deprecated) | String emailList | EmailListEntry |