Method: contactGroups.create
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2024/08/21 (UTC).
[null,null,["Dernière mise à jour le 2024/08/21 (UTC)."],[[["\u003cp\u003eCreate new contact groups owned by the authenticated user with unique names.\u003c/p\u003e\n"],["\u003cp\u003eDuplicate contact group names will result in an HTTP 409 error.\u003c/p\u003e\n"],["\u003cp\u003eSequential mutate requests from the same user are recommended to minimize latency and failures.\u003c/p\u003e\n"],["\u003cp\u003eThis operation requires the \u003ccode\u003ehttps://www.googleapis.com/auth/contacts\u003c/code\u003e OAuth scope.\u003c/p\u003e\n"]]],["This documentation outlines how to create a new contact group via the Google People API. A `POST` request to `https://people.googleapis.com/v1/contactGroups` is required, with a JSON request body that defines the `contactGroup` object and optional `readGroupFields`. Group names must be unique per user, and duplicate names return a 409 error. The successful response returns the newly created `ContactGroup` and needs to be done with `https://www.googleapis.com/auth/contacts` scope. Mutate requests must be sent sequentially.\n"],null,["# Method: contactGroups.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreate a new contact group owned by the authenticated user.\n\nCreated contact group names must be unique to the users contact groups. Attempting to create a group with a duplicate name will return a HTTP 409 error.\n\nMutate requests for the same user should be sent sequentially to avoid increased latency and failures.\n\n### HTTP request\n\n`POST https://people.googleapis.com/v1/contactGroups`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------|\n| ``` { \"contactGroup\": { object (/people/api/rest/v1/contactGroups#ContactGroup) }, \"readGroupFields\": string } ``` |\n\n| Fields ||\n|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `contactGroup` | `object (`[ContactGroup](/people/api/rest/v1/contactGroups#ContactGroup)`)` Required. The contact group to create. |\n| `readGroupFields` | `string (`[FieldMask](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask)` format)` Optional. A field mask to restrict which fields on the group are returned. Defaults to `metadata`, `groupType`, and `name` if not set or set to empty. Valid fields are: - clientData - groupType - metadata - name |\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [ContactGroup](/people/api/rest/v1/contactGroups#ContactGroup).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/contacts`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]