This page explains how to bulk read messages from an HL7v2 store using the projects.locations.datasets.hl7V2Stores.messages.batchGet method.
You can use batchGet to retrieve up to 100 HL7v2 messages with a single call.
You can use the projects.locations.datasets.hl7V2Stores.messages.get
message to retrieve a single HL7v2 message at a time, but if you have many messages,
you might encounter excessive network costs. To retrieve multiple messages
in one API call, use batchGet.
Getting HL7v2 messages in bulk
The following samples show how to get the contents of HL7v2 messages in bulk.
For more information, see
projects.locations.datasets.hl7V2Stores.messages.batchGet.
curl
To get HL7v2 messages in bulk, make a GET request and specify the following information:
- The name of the parent dataset
- The name of the HL7v2 store
- An access token
- The query parameter
nameswith the names of the HL7v2 messages you want to retrieve. For eachnamesvalue, enter the fully qualified path to the message in the format:projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID
The following sample shows a GET request using curl.
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID /locations/LOCATION/datasets/DATASET_ID /hl7V2Stores/HL7V2_STORE_ID/messages:batchGet?names=MESSAGE_NAME_1&names=MESSAGE_NAME_2&names= MESSAGE_NAME_3&view=FULL"
If the request is successful, the server returns the response in JSON format:
{
"messages" : [
{
"name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID"
}
]
}
PowerShell
To get HL7v2 messages in bulk, make a GET request and specify the following information:
- The name of the parent dataset
- The name of the HL7v2 store
- An access token
- The query parameter
nameswith the names of the HL7v2 messages you want to retrieve. For eachnamesvalue, enter the fully qualified path to the message in the format:projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID
The following sample shows a GET request using Windows PowerShell.
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages:batchGet?names=MESSAGE_NAME_1&names=MESSAGE_NAME_2&names=MESSAGE_NAME_3&view=FULL" | Select-Object -Expand Content
If the request is successful, the server returns the response in JSON format:
{
"messages" : [
{
"name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/MESSAGE_ID"
}
]
}