À partir du 8 septembre 2025, chaque nouvelle ligne devra indiquer si elle diffusera ou non des annonces à caractère politique dans l'Union européenne (UE). Les importations de fichiers SDF et les appels à l'API Display & Video 360 qui ne fournissent pas de déclarations échoueront. Pour savoir comment mettre à jour votre intégration afin d'effectuer cette déclaration, consultez notre page sur les abandons de compatibilité.
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Une fois votre opération terminée et que vous avez extrait le nom de la ressource de la réponse de l'opération terminée, vous pouvez télécharger le fichier ZIP contenant les fichiers SDF générés à l'aide de la méthode media.download.
Voici un exemple d'utilisation d'une bibliothèque cliente pour télécharger le fichier obtenu:
Java
// Extract download file resource name to use in download requestStringdownloadResourceName=operationResponse.getResponse().get("resourceName").toString();// Configure the Media.download requestMedia.DownloaddownloadRequest=service.media().download(downloadResourceName);// Create output stream for downloaded fileFileOutputStreamoutStream=newFileOutputStream(output-file);// Download filedownloadRequest.executeMediaAndDownloadTo(outStream);System.out.printf("File downloaded to %s\n",outputFile);
Python
# Extract download file resource name to use in download requestresourceName=operation["response"]["resourceName"]# Configure the Media.download requestdownloadRequest=service.media().download_media(resourceName=resourceName)# Create output stream for downloaded fileoutStream=io.FileIO(output-file,mode='wb')# Make downloader objectdownloader=googleHttp.MediaIoBaseDownload(outStream,downloadRequest)# Download media file in chunks until finisheddownload_finished=Falsewhiledownload_finishedisFalse:_,download_finished=downloader.next_chunk()print("File downloaded to %s"%output-file)
PHP
// Get client and set defer so it doesn't immediately return.$client = $this->service->getClient();$client->setDefer(true);// Build media download request.$request = $this->service->media->download( $operation->getResponse()['resourceName'], array('alt' => 'media'));// Call the API, getting the generated SDF.$response = $client->execute($request);$responseBody = $response->getBody();// Writes the downloaded file. If the file already exists, it is// overwritten.file_put_contents(output-file, $responseBody);$client->setDefer(false);printf('File saved to: %s\n', output-file);
Une fois votre fichier téléchargé et décompressé, les fichiers de données structurées générés seront disponibles. Les fichiers générés auront des noms génériques identifiant le type de fichier SDF (par exemple, SDF-LineItems.csv).
Fichiers ignorés
Si les données d'une ressource demandée ne peuvent pas être incluses dans le fichier de données structurées correspondant, le fichier ZIP téléchargé peut inclure un fichier "Ignoré" (par exemple, SDF-LineItems-Skipped.csv). Ce fichier aura une structure à deux colonnes, la première contenant les ID des ressources qui n'ont pas pu être incluses et la seconde contenant le motif de leur exclusion.
Les ressources peuvent être ignorées pour de nombreuses raisons, par exemple si elles sont dans un état ou d'un type non compatibles. Évitez que des ressources soient ignorées en utilisant la dernière version de SDF.
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/07/25 (UTC).
[null,null,["Dernière mise à jour le 2025/07/25 (UTC)."],[[["\u003cp\u003eAfter a successful operation, download the generated SDFs as a zip file using the \u003ccode\u003emedia.download\u003c/code\u003e method, ensuring the \u003ccode\u003ealt\u003c/code\u003e parameter is set to \u003ccode\u003emedia\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eClient libraries simplify the download process, but if using a direct download URL, append \u003ccode\u003e?alt=media\u003c/code\u003e to ensure proper data format.\u003c/p\u003e\n"],["\u003cp\u003eExtract the download file resource name from the operation response to initiate the download using your preferred client library (Java, Python, or PHP examples provided).\u003c/p\u003e\n"],["\u003cp\u003eDownloaded zip files contain generically named SDF files; a "Skipped" file might be included if certain resources could not be processed, detailing the reasons for exclusion.\u003c/p\u003e\n"],["\u003cp\u003eMinimize skipped resources by utilizing the latest SDF version to ensure compatibility and support for your resource types and states.\u003c/p\u003e\n"]]],["After a successful operation, extract the `resourceName` to download a zip file containing generated SDFs. Use the `media.download` method with `alt=media` to specify the data format. Client libraries automate this process. Download the file by configuring a `Media.Download` request, creating an output stream, and executing the request to download the file into the stream. The zip file contains structured data files like `SDF-LineItems.csv`. A `Skipped.csv` file might be included, listing resources not included and why.\n"],null,["# Download the SDF\n\nOnce your operation has finished successfully and you've extracted the resource\nname from the completed operation response, you are ready to download the zip\nfile containing your generated SDFs using the [`media.download`](/display-video/api/reference/rest/current/media/download)\nmethod.\n| **Note:** You must specify the data format for your download response as `media` through the `alt` parameter. This can be done by appending `?alt=media` to your download url. Client libraries take care of this for you.\n\nHere's an example of how to use a client library to download the resulting file: \n\n### Java\n\n```java\n// Extract download file resource name to use in download request\nString downloadResourceName = operationResponse.getResponse()\n .get(\"resourceName\").toString();\n\n// Configure the Media.download request\nMedia.Download downloadRequest =\n service\n .media()\n .download(downloadResourceName);\n\n// Create output stream for downloaded file\nFileOutputStream outStream =\n new FileOutputStream(output-file);\n\n// Download file\ndownloadRequest.executeMediaAndDownloadTo(outStream);\n\nSystem.out.printf(\"File downloaded to %s\\n\", outputFile);\n```\n\n### Python\n\n```python\n# Extract download file resource name to use in download request\nresourceName = operation[\"response\"][\"resourceName\"]\n\n# Configure the Media.download request\ndownloadRequest = service.media().download_media(resourceName=resourceName)\n\n# Create output stream for downloaded file\noutStream = io.FileIO(output-file, mode='wb')\n\n# Make downloader object\ndownloader = googleHttp.MediaIoBaseDownload(outStream, downloadRequest)\n\n# Download media file in chunks until finished\ndownload_finished = False\nwhile download_finished is False:\n _, download_finished = downloader.next_chunk()\n\nprint(\"File downloaded to %s\" % output-file)\n```\n\n### PHP\n\n```php\n// Get client and set defer so it doesn't immediately return.\n$client = $this-\u003eservice-\u003egetClient();\n$client-\u003esetDefer(true);\n\n// Build media download request.\n$request = $this-\u003eservice-\u003emedia-\u003edownload(\n $operation-\u003egetResponse()['resourceName'],\n array('alt' =\u003e 'media')\n);\n\n// Call the API, getting the generated SDF.\n$response = $client-\u003eexecute($request);\n$responseBody = $response-\u003egetBody();\n\n// Writes the downloaded file. If the file already exists, it is\n// overwritten.\nfile_put_contents(\u003cvar translate=\"no\"\u003eoutput-file\u003c/var\u003e, $responseBody);\n$client-\u003esetDefer(false);\n\nprintf('File saved to: %s\\n', \u003cvar translate=\"no\"\u003eoutput-file\u003c/var\u003e);\n```\n\nOnce your file is downloaded and unzipped, your generated structured data files\nwill be available to you. The generated files will have generic names\nidentifying the SDF file type (example: `SDF-LineItems.csv`).\n\nSkipped files\n-------------\n\nIf data for a requested resource cannot be included in the corresponding\nstructured data file, the zip file downloaded might include a \"Skipped\" file\n(example: `SDF-LineItems-Skipped.csv`). This file will have a two-column\nstructure, the first containing the IDs of the resources that couldn't be\nincluded and the second containing the reason for their exclusion.\n\nResources may be skipped for many reasons, including being in an unsupported\nstate or of an unsupported type. Avoid having resources skipped by using the\nmost recent version of SDF."]]