Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Nesta página, explicamos como ler mensagens em massa de um armazenamento de HL7v2 usando o método projects.locations.datasets.hl7V2Stores.messages.batchGet.
Use batchGet para recuperar até 100 mensagens HL7v2 com uma única chamada.
Use a mensagem projects.locations.datasets.hl7V2Stores.messages.get
para recuperar uma única mensagem HL7v2 por vez. Porém, se tiver muitas mensagens,
poderá haver custos de rede excessivos. Para recuperar várias mensagens
em uma chamada de API, use batchGet.
Como receber mensagens HL7v2 em massa
Os exemplos a seguir mostram como obter o conteúdo das mensagens HL7v2 em massa.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-18 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)"]]