Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Vous pouvez suivre ce guide de démarrage rapide pour vous familiariser avec l'API Data Manager.
Choisissez la version du démarrage rapide que vous souhaitez consulter :
Dans ce guide de démarrage rapide, vous allez effectuer les étapes suivantes :
Préparez un Destination pour recevoir les données d'audience.
Préparez les données d'audience à envoyer.
Créez une requête IngestionService pour les membres de l'audience.
Envoyez la requête avec Google APIs Explorer.
Comprendre les réponses de réussite et d'échec
Préparer une destination
Avant de pouvoir envoyer des données, vous devez préparer la destination vers laquelle les envoyer. Voici un exemple de Destination que vous pouvez utiliser :
Définissez operatingAccount sur le produit et l'ID du compte qui recevra les données d'audience.
Préparer les données d'audience
Prenons l'exemple de données suivant dans un fichier séparé par des virgules. Chaque ligne du fichier correspond à un membre de l'audience, et chaque membre peut avoir jusqu'à trois adresses e-mail.
Voici un exemple de AudienceMember pour les adresses e-mail formatées, hachées et encodées de dana@example.com et danam@example.com de la première ligne des données d'entrée :
Remplacez les espaces réservés dans le corps, tels que OPERATING_ACCOUNT_PRODUCT, OPERATING_ACCOUNT_ID et AUDIENCE_ID, par les valeurs de votre compte et de votre destination.
Définissez validateOnly sur true pour valider la requête sans appliquer les modifications. Lorsque vous êtes prêt à appliquer les modifications, définissez validateOnly sur false.
Une requête ayant échoué génère un code d'état de réponse d'erreur tel que 400 Bad
Request, ainsi qu'une réponse contenant des informations sur l'erreur.
Par exemple, un email_address contenant une chaîne de texte brut au lieu d'une valeur encodée en hexadécimal produit la réponse suivante :
{"error":{"code":400,"message":"There was a problem with the request.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"INVALID_ARGUMENT","domain":"datamanager.googleapis.com"},{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"audience_members.audience_members[0].user_data.user_identifiers","description":"Email is not hex encoded.","reason":"INVALID_HEX_ENCODING"}]}]}}
Un email_address non haché et uniquement encodé en hexadécimal produit la réponse suivante :
{"error":{"code":400,"message":"There was a problem with the request.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"INVALID_ARGUMENT","domain":"datamanager.googleapis.com"},{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"audience_members.audience_members[0]","reason":"INVALID_SHA256_FORMAT"}]}]}}
Étapes suivantes
Configurez l'authentification et votre environnement avec une bibliothèque cliente.
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 2025/08/13 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/08/13 (UTC)."],[],[],null,["# Send audience members\n\nYou can work through this quickstart to get familiar with the Data Manager API.\nChoose the version of the quickstart you want to see:\n\nAdvertiser Data Partner\n\nIn this quickstart, you complete the following steps:\n\n1. Prepare a [`Destination`](/data-manager/api/reference/rest/v1/Destination) to receive audience data.\n2. Prepare audience data to send.\n3. Build an [`IngestionService`](/data-manager/api/reference/rest/v1/audienceMembers/ingest) request for audience members.\n4. Send the request with the Google APIs Explorer.\n5. Understand success and failure responses.\n\nPrepare a destination\n---------------------\n\nBefore you can send data, you need to prepare the destination to send the data\nto. Here's a sample `Destination` for you to use: \n\n {\n \"operatingAccount\": {\n \"product\": \"\u003cvar translate=\"no\"\u003eOPERATING_ACCOUNT_PRODUCT\u003c/var\u003e\",\n \"accountId\": \"\u003cvar translate=\"no\"\u003eOPERATING_ACCOUNT_ID\u003c/var\u003e\"\n },\n\n \"productDestinationId\": \"\u003cvar translate=\"no\"\u003eAUDIENCE_ID\u003c/var\u003e\"\n }\n\n- Set the `operatingAccount` to the product and ID of the account that will\n receive the audience data.\n\nPrepare audience data\n---------------------\n\nConsider the following sample data in a comma-separated file. Each line in the\nfile corresponds to one member of the audience, and each member has up to three\nemail addresses. \n\n #,email_1,email_2,email_3\n 1,dana@example.com,DanaM@example.com,\n 2,ALEXJ@example.com, AlexJ@cymbalgroup.com,alexj@altostrat.com\n 3,quinn@CYMBALGROUP.com,baklavainthebalkans@gmail.com ,\n 4,rosario@example.org,cloudySanFrancisco@GMAIL.com,\n\nEmail addresses have the following [formatting](/data-manager/api/get-started/formatting) and\nhashing requirements:\n\n1. Remove all leading, trailing, and intermediate whitespace.\n2. Convert the email address to lowercase.\n3. Hash the email address using the [SHA-256 algorithm](//en.wikipedia.org/wiki/SHA-2).\n4. Encode the hash bytes using [hexadecimal](//en.wikipedia.org/wiki/Hexadecimal) (hex) or [Base64 encoding](//en.wikipedia.org/wiki/Base64). The examples in this guide use hex encoding.\n\nHere's the formatted data: \n\n #,email_1,email_2,email_3\n 1,dana@example.com,danam@example.com,\n 2,alexj@example.com,alexj@cymbalgroup.com,alexj@altostrat.com\n 3,quinn@cymbalgroup.com,baklavainthebalkans@gmail.com,\n 4,rosario@example.org,cloudysanfrancisco@gmail.com,\n\nAnd here's the data after being hashed and encoded: \n\n #,email_1,email_2,email_3\n 1,07e2f1394b0ea80e2adca010ea8318df697001a005ba7452720edda4b0ce57b3,1df6b43bc68dd38eca94e6a65b4f466ae537b796c81a526918b40ac4a7b906c7\n 2,2ef46c4214c3fc1b277a2d976d55194e12b899aa50d721f28da858c7689756e3,54e410b14fa652a4b49b43aff6eaf92ad680d4d1e5e62ed71b86cd3188385a51,e8bd3f8da6f5af73bec1ab3fbf7beb47482c4766dfdfc94e6bd89e359c139478\n 3,05bb62526f091b45d20e243d194766cca8869137421047dc53fa4876d111a6f0,f1fcde379f31f4d446b76ee8f34860eca2288adc6b6d6c0fdc56d9eee75a2fa5\n 4,83a834cc5327bc4dee7c5408988040dc5813c7662611cd93b707aff72bf7d33f,223ebda6f6889b1494551ba902d9d381daf2f642bae055888e96343d53e9f9c4\n\nHere's a sample `AudienceMember` for the formatted, hashed, and encoded email\naddresses of `dana@example.com` and `danam@example.com` from the first row of\nthe input data: \n\n {\n \"userData\": {\n \"userIdentifiers\": [\n {\n \"emailAddress\": \"07e2f1394b0ea80e2adca010ea8318df697001a005ba7452720edda4b0ce57b3\"\n },\n {\n \"emailAddress\": \"1df6b43bc68dd38eca94e6a65b4f466ae537b796c81a526918b40ac4a7b906c7\"\n }\n ]\n }\n }\n\nBuild the request body\n----------------------\n\nCombine the `Destination` and `userData` for the request body: \n\n {\n \"destinations\": [\n {\n \"operatingAccount\": {\n \"product\": \"\u003cvar translate=\"no\"\u003eOPERATING_ACCOUNT_PRODUCT\u003c/var\u003e\",\n \"accountId\": \"\u003cvar translate=\"no\"\u003eOPERATING_ACCOUNT_ID\u003c/var\u003e\"\n },\n\n \"productDestinationId\": \"\u003cvar translate=\"no\"\u003eAUDIENCE_ID\u003c/var\u003e\"\n }\n ],\n \"audienceMembers\": [\n {\n \"userData\": {\n \"userIdentifiers\": [\n {\n \"emailAddress\": \"07e2f1394b0ea80e2adca010ea8318df697001a005ba7452720edda4b0ce57b3\"\n },\n {\n \"emailAddress\": \"1df6b43bc68dd38eca94e6a65b4f466ae537b796c81a526918b40ac4a7b906c7\"\n }\n ]\n }\n },\n {\n \"userData\": {\n \"userIdentifiers\": [\n {\n \"emailAddress\": \"2ef46c4214c3fc1b277a2d976d55194e12b899aa50d721f28da858c7689756e3\"\n },\n {\n \"emailAddress\": \"54e410b14fa652a4b49b43aff6eaf92ad680d4d1e5e62ed71b86cd3188385a51\"\n },\n {\n \"emailAddress\": \"e8bd3f8da6f5af73bec1ab3fbf7beb47482c4766dfdfc94e6bd89e359c139478\"\n }\n ]\n }\n },\n {\n \"userData\": {\n \"userIdentifiers\": [\n {\n \"emailAddress\": \"05bb62526f091b45d20e243d194766cca8869137421047dc53fa4876d111a6f0\"\n },\n {\n \"emailAddress\": \"f1fcde379f31f4d446b76ee8f34860eca2288adc6b6d6c0fdc56d9eee75a2fa5\"\n }\n ]\n }\n },\n {\n \"userData\": {\n \"userIdentifiers\": [\n {\n \"emailAddress\": \"83a834cc5327bc4dee7c5408988040dc5813c7662611cd93b707aff72bf7d33f\"\n },\n {\n \"emailAddress\": \"223ebda6f6889b1494551ba902d9d381daf2f642bae055888e96343d53e9f9c4\"\n }\n ]\n }\n }\n ],\n \"consent\": {\n \"adUserData\": \"CONSENT_GRANTED\",\n \"adPersonalization\": \"CONSENT_GRANTED\"\n },\n \"encoding\": \"HEX\",\n \"termsOfService\": {\n \"customerMatchTermsOfServiceStatus\": \"ACCEPTED\"\n },\n \"validateOnly\": \u003cvar scope=\"VALIDATE_ONLY\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-kc\"\u003etrue\u003c/span\u003e\u003c/var\u003e\n }\n\n1. Update the placeholders in the body, such as \u003cvar translate=\"no\"\u003eOPERATING_ACCOUNT_PRODUCT\u003c/var\u003e, \u003cvar translate=\"no\"\u003eOPERATING_ACCOUNT_ID\u003c/var\u003e, and \u003cvar translate=\"no\"\u003eAUDIENCE_ID\u003c/var\u003e with the values for your account and destination.\n2. Set `validateOnly` to `true` to validate the request without applying the changes. When you're ready to apply the changes, set `validateOnly` to `false`.\n3. Set `termsOfService` to indicate that the user has accepted the [Customer\n Match terms of service](//support.google.com/adspolicy/answer/6299717).\n4. Note this request indicates that `consent` is granted, and doesn't use encryption.\n\nSend the request\n----------------\n\n1. Copy the request body using the copy button at the top right of the sample.\n2. Click the **API** button in the toolbar.\n3. Paste the copied request body into the **Request body** box.\n4. Click the **Execute** button, complete the authorization prompts, and review the response.\n\nSuccess responses\n-----------------\n\nA successful request returns a response with an object containing a `requestId`. \n\n {\n \"requestId\": \"126365e1-16d0-4c81-9de9-f362711e250a\"\n }\n\nFailure responses\n-----------------\n\nA failed request results in an error response status code such as `400 Bad\nRequest`, and a response with error details.\n\nFor example, an `email_address` containing a plain text string instead of a hex\nencoded value produces the following response: \n\n {\n \"error\": {\n \"code\": 400,\n \"message\": \"There was a problem with the request.\",\n \"status\": \"INVALID_ARGUMENT\",\n \"details\": [\n {\n \"@type\": \"type.googleapis.com/google.rpc.ErrorInfo\",\n \"reason\": \"INVALID_ARGUMENT\",\n \"domain\": \"datamanager.googleapis.com\"\n },\n {\n \"@type\": \"type.googleapis.com/google.rpc.BadRequest\",\n \"fieldViolations\": [\n {\n \"field\": \"audience_members.audience_members[0].user_data.user_identifiers\",\n \"description\": \"Email is not hex encoded.\",\n \"reason\": \"INVALID_HEX_ENCODING\"\n }\n ]\n }\n ]\n }\n }\n\nAn `email_address` that isn't hashed and is only hex encoded produces the\nfollowing response: \n\n {\n \"error\": {\n \"code\": 400,\n \"message\": \"There was a problem with the request.\",\n \"status\": \"INVALID_ARGUMENT\",\n \"details\": [\n {\n \"@type\": \"type.googleapis.com/google.rpc.ErrorInfo\",\n \"reason\": \"INVALID_ARGUMENT\",\n \"domain\": \"datamanager.googleapis.com\"\n },\n {\n \"@type\": \"type.googleapis.com/google.rpc.BadRequest\",\n \"fieldViolations\": [\n {\n \"field\": \"audience_members.audience_members[0]\",\n \"reason\": \"INVALID_SHA256_FORMAT\"\n }\n ]\n }\n ]\n }\n }\n\nNext steps\n----------\n\n- [Configure](/data-manager/api/get-started/set-up-access) authentication and setup your environment with a client library.\n- Learn about the [formatting, hashing, and encoding requirements](/data-manager/api/get-started/formatting) for each type of data.\n- Learn how to [encrypt user data](/data-manager/api/get-started/encryption).\n- Learn about [best practices](/data-manager/api/get-started/best-practices).\n- Learn about [limits and quotas](/data-manager/api/limits)."]]