Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment lire des messages d'un magasin HL7v2 de façon groupée à l'aide de la méthode projects.locations.datasets.hl7V2Stores.messages.batchGet.
Vous pouvez utiliser batchGet pour récupérer jusqu'à 100 messages HL7v2 avec un seul appel.
Vous pouvez utiliser le message projects.locations.datasets.hl7V2Stores.messages.get pour récupérer un seul message HL7v2 à la fois, mais si vous avez de nombreux messages, des coûts de réseau excessifs peuvent s'appliquer. Pour récupérer plusieurs messages dans un même appel d'API, utilisez batchGet.
Obtenir des messages HL7v2 de façon groupée
Les exemples suivants montrent comment obtenir le contenu des messages HL7v2 de façon groupée.
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/09/10 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/10 (UTC)."],[[["\u003cp\u003eThis page describes how to use the \u003ccode\u003ebatchGet\u003c/code\u003e method to retrieve up to 100 HL7v2 messages in bulk with a single API call, which helps avoid excessive network costs compared to retrieving messages one at a time.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebatchGet\u003c/code\u003e method is currently in Beta, meaning it is subject to "Pre-GA Offerings Terms," is available "as is", and may have limited support.\u003c/p\u003e\n"],["\u003cp\u003eTo use \u003ccode\u003ebatchGet\u003c/code\u003e, a \u003ccode\u003eGET\u003c/code\u003e request must be made specifying the parent dataset name, the HL7v2 store name, an access token, and the fully qualified paths of the messages you want to retrieve in the \u003ccode\u003enames\u003c/code\u003e query parameter.\u003c/p\u003e\n"],["\u003cp\u003eThe fully qualified paths for messages should be in the format \u003ccode\u003eprojects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe API request can be done using either \u003ccode\u003ecurl\u003c/code\u003e or \u003ccode\u003ePowerShell\u003c/code\u003e, and a successful request will return the HL7v2 messages in a JSON formatted response.\u003c/p\u003e\n"]]],[],null,["# Retrieving HL7v2 messages in bulk\n\n| **Beta**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis page explains how to bulk read messages from an HL7v2 store using the [`projects.locations.datasets.hl7V2Stores.messages.batchGet`](/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.hl7V2Stores.messages/batchGet) method.\nYou can use `batchGet` to retrieve up to 100 HL7v2 messages with a single call.\n\nYou can use the [`projects.locations.datasets.hl7V2Stores.messages.get`](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.messages/get)\nmessage to retrieve a single HL7v2 message at a time, but if you have many messages,\nyou might encounter excessive network costs. To retrieve multiple messages\nin one API call, use `batchGet`.\n\nGetting HL7v2 messages in bulk\n------------------------------\n\nThe following samples show how to get the contents of HL7v2 messages in bulk.\n\nFor more information, see\n[`projects.locations.datasets.hl7V2Stores.messages.batchGet`](/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.hl7V2Stores.messages/batchGet). \n\n### curl\n\nTo get HL7v2 messages in bulk, make a `GET` request and specify the following information:\n\n- The name of the parent dataset\n- The name of the HL7v2 store\n- An access token\n- The query parameter `names` with the names of the HL7v2 messages you want to retrieve. For each `names` value, enter the fully qualified path to the message in the format: `projects/`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/datasets/`\u003cvar translate=\"no\"\u003eDATASET_ID\u003c/var\u003e`/hl7V2Stores/`\u003cvar translate=\"no\"\u003eHL7V2_STORE_ID\u003c/var\u003e`/messages/`\u003cvar translate=\"no\"\u003eMESSAGE_ID\u003c/var\u003e\n\nThe following sample shows a `GET` request using `curl`. \n\n```bash\ncurl -X GET \\\n -H \"Authorization: Bearer $(gcloud auth application-default print-access-token)\" \\\n \"https://healthcare.googleapis.com/v1beta1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n /locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/datasets/\u003cvar translate=\"no\"\u003eDATASET_ID\u003c/var\u003e\n /hl7V2Stores/\u003cvar translate=\"no\"\u003eHL7V2_STORE_ID\u003c/var\u003e/messages:batchGet?names=\u003cvar translate=\"no\"\u003eMESSAGE_NAME_1\u003c/var\u003e&names=\u003cvar translate=\"no\"\u003eMESSAGE_NAME_2\u003c/var\u003e&names=\n \u003cvar translate=\"no\"\u003eMESSAGE_NAME_3\u003c/var\u003e&view=FULL\"\n```\n\nIf the request is successful, the server returns the response in JSON format: \n\n```\n{\n \"messages\" : [\n {\n \"name\": \"projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID\"\n }\n ]\n}\n```\n\n### PowerShell\n\nTo get HL7v2 messages in bulk, make a `GET` request and specify the following information:\n\n- The name of the parent dataset\n- The name of the HL7v2 store\n- An access token\n- The query parameter `names` with the names of the HL7v2 messages you want to retrieve. For each `names` value, enter the fully qualified path to the message in the format: `projects/`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/datasets/`\u003cvar translate=\"no\"\u003eDATASET_ID\u003c/var\u003e`/hl7V2Stores/`\u003cvar translate=\"no\"\u003eHL7V2_STORE_ID\u003c/var\u003e`/messages/`\u003cvar translate=\"no\"\u003eMESSAGE_ID\u003c/var\u003e\n\nThe following sample shows a `GET` request using Windows PowerShell. \n\n```bash\n$cred = gcloud auth application-default print-access-token\n$headers = @{ Authorization = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method Get `\n -Headers $headers `\n -Uri \"https://healthcare.googleapis.com/v1beta1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/datasets/\u003cvar translate=\"no\"\u003eDATASET_ID\u003c/var\u003e/hl7V2Stores/\u003cvar translate=\"no\"\u003eHL7V2_STORE_ID\u003c/var\u003e/messages:batchGet?names=\u003cvar translate=\"no\"\u003eMESSAGE_NAME_1\u003c/var\u003e&names=\u003cvar translate=\"no\"\u003eMESSAGE_NAME_2\u003c/var\u003e&names=\u003cvar translate=\"no\"\u003eMESSAGE_NAME_3\u003c/var\u003e&view=FULL\" | Select-Object -Expand Content\n```\n\nIf the request is successful, the server returns the response in JSON format: \n\n```\n{\n \"messages\" : [\n {\n \"name\": \"projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID\"\n }\n ]\n}\n```\n\n\u003cbr /\u003e\n\nSee also\n--------\n\n- [Creating and managing HL7v2 messages](/healthcare-api/docs/how-tos/hl7v2-messages)"]]