Method: people.updateContactPhoto
Stay organized with collections
Save and categorize content based on your preferences.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eUpdate a contact's photo by providing raw photo bytes and optionally specifying fields to return using a field mask.\u003c/p\u003e\n"],["\u003cp\u003eThe request must include \u003ccode\u003ephotoBytes\u003c/code\u003e in base64-encoded format and can optionally include \u003ccode\u003epersonFields\u003c/code\u003e and \u003ccode\u003esources\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe response will contain the updated \u003ccode\u003eperson\u003c/code\u003e object if \u003ccode\u003epersonFields\u003c/code\u003e are set in the request.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with the \u003ccode\u003ehttps://www.googleapis.com/auth/contacts\u003c/code\u003e scope.\u003c/p\u003e\n"],["\u003cp\u003eSend sequential mutation requests for the same user to avoid latency and failures.\u003c/p\u003e\n"]]],["This describes how to update a contact's photo using a PATCH request to `people.googleapis.com/v1/{resourceName=people/*}:updateContactPhoto`. The `resourceName` path parameter is required. The request body must include `photoBytes` (base64-encoded), and optionally `personFields` and `sources`. The response body contains the updated `person` object, if `personFields` is set. Sequential requests are recommended to avoid latency and failures. The request requires the `https://www.googleapis.com/auth/contacts` authorization scope.\n"],null,["# Method: people.updateContactPhoto\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.UpdateContactPhotoResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nUpdate a contact's photo.\n\nMutate requests for the same user should be sent sequentially to avoid increased latency and failures.\n\n### HTTP request\n\n`PATCH https://people.googleapis.com/v1/{resourceName=people/*}:updateContactPhoto`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------------|-----------------------------------------|\n| `resourceName` | `string` Required. Person resource name |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------|\n| ``` { \"photoBytes\": string, \"personFields\": string, \"sources\": [ enum (/people/api/rest/v1/ReadSourceType) ] } ``` |\n\n| Fields ||\n|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `photoBytes` | `string (`[bytes](https://developers.google.com/discovery/v1/type-format)` format)` Required. Raw photo bytes A base64-encoded string. |\n| `personFields` | `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 person are returned. Multiple fields can be specified by separating them with commas. Defaults to empty if not set, which will skip the post mutate get. Valid values are: - addresses - ageRanges - biographies - birthdays - calendarUrls - clientData - coverPhotos - emailAddresses - events - externalIds - genders - imClients - interests - locales - locations - memberships - metadata - miscKeywords - names - nicknames - occupations - organizations - phoneNumbers - photos - relations - sipAddresses - skills - urls - userDefined |\n| `sources[]` | `enum (`[ReadSourceType](/people/api/rest/v1/ReadSourceType)`)` Optional. A mask of what source types to return. Defaults to [READ_SOURCE_TYPE_CONTACT](/people/api/rest/v1/ReadSourceType#ENUM_VALUES.READ_SOURCE_TYPE_CONTACT) and [READ_SOURCE_TYPE_PROFILE](/people/api/rest/v1/ReadSourceType#ENUM_VALUES.READ_SOURCE_TYPE_PROFILE) if not set. |\n\n### Response body\n\nThe response for updating a contact's photo.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|----------------------------------------------------------------------|\n| ``` { \"person\": { object (/people/api/rest/v1/people#Person) } } ``` |\n\n| Fields ||\n|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `person` | `object (`[Person](/people/api/rest/v1/people#Person)`)` The updated person, if personFields is set in the UpdateContactPhotoRequest; otherwise this will be unset. |\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)."]]