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.

Adding people to circles

The Google+ Domains API allows your app to add domain users to a circle on behalf of a domain user. The API limits operations to only users within your apps domain. Google+ limits certain circle operations, including the number of users you can add to a circle.

To add a user to a circle, your app must request the following scope:

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 add people to a circle, identified by circleId, within your Google Apps domain.

Java

// This sample assumes a client object `plusDomains` has been created,
// and that you know the ID of the user you want to add, as well as the
// ID of the circle you want to add to.
// To learn more about creating a client, see the OAuth 2.0 example:
//  https://developers.google.com/+/domains/authentication/

import java.util.ArrayList;
import com.google.api.services.plusDomains.PlusDomains.Circles.AddPeople;
import com.google.api.services.plusDomains.model.Circle;

String circleId = "a1234b";
String userId = "1234";

List<String> addUserIds = new ArrayList<String>();
addUserIds.add(userId)

AddPeople addPeople = plusDomains.circles().addPeople(circleId);
addPeople.setUserId(addUserIds);
Circle resultOfCircleAddPeople = addPeople.execute();

Python

# This sample assumes a client object `service` has been created, and
# that you know the ID of the user you want to add, as well as the ID of
# the circle you want to add to.
# To learn more about creating a client, see the OAuth 2.0 example:
#  https://developers.google.com/+/domains/authentication/

user_id = '1234'
circle_id = 'a1234b'

add_service = service.circles().addPeople(circleId=circle_id, userId=user_id)
result = add_service.execute()

Protocol

See the Circles.addPeople REST API method.

Send feedback about...

Google+ Domains API
Google+ Domains API