Legacy Google+ APIs have been shut down as of March 7, 2019. Changes to the shutdown plan have been made recently which may mitigate its effect on some developers. Learn more.

Google+ integrations for web and mobile apps have also stopped functioning as of March 7, 2019. Learn more.

Creating circles

The Google+ Domains API allows your app to create new circles on behalf of users within your Google Apps domain.

To create a circle, your app must request the following scopes:

https://www.googleapis.com/auth/plus.me
Grants the app permission to use the special value me to represent the authenticated user. Does not apply to apps that use domain-wide delegation of authority.
https://www.googleapis.com/auth/plus.circles.write
Required - Grants permission for the app to create circles, delete circles, add people and pages to the user's circles, and remove people and pages from the user's circles. The Google+ Domains API only permits adding and removing people in the same Google Apps domain as the user.

The following example demonstrates how to create an empty circle for an authenticated user within your Google Apps domain. A successful creation will return a circle resource in the response body that you can then use to add people to the circle.

Java

// This sample assumes a client object, `plusDomains` has been created
// and your app has an access token to use on behalf of the user.
// To learn more about creating a client, see the OAuth 2.0 example:
//  https://developers.google.com/+/domains/authentication/

import com.google.api.services.plusDomains.model.Circle;

Circle circle = new Circle();
circle.setDisplayName("Tech support");
Circle result = plusDomains.circles().insert("me", circle).execute();

System.out.println("Created 'Tech support' circle with id: " + result.getId());

Python

# This sample assumes a client object, `service` has been created and
# your app has an access token to use on behalf of the user.
# To learn more about creating a client, see the OAuth 2.0 example:
#  https://developers.google.com/+/domains/authentication/

new_circle = {
    'displayName': 'Flair Club'
}
result = service.circles().insert(userId = 'me', body = new_circle).execute()
print "Inserted '%s' circle with id: %s" % (new_circle.get('displayName'),
                                            result.get('id'))

Protocol

See the Circles.insert REST API method.

Send feedback about...

Google+ Domains API
Google+ Domains API