# Store healthcare data with curl and PowerShell


This page shows you how to use the Cloud Healthcare API and `curl` or PowerShell
to complete the following tasks:

1. Create a Cloud Healthcare API dataset.
2. Create one of the following data stores inside the dataset:
   - Digital Imaging and Communications in Medicine (DICOM) store
   - Fast Healthcare Interoperability Resources (FHIR) store
   - Health Level Seven International Version 2 (HL7v2) store
3. Store and inspect a particular type of medical data in the DICOM, FHIR, or HL7v2 store.

If you're only interested in working with one type of data store, you can skip
directly to that section of the quickstart after completing the steps in
[Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin) and [Create a dataset](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#create-dataset).

## Before you begin

<br />

## Create a dataset


*Datasets* contain data stores, and data stores contain healthcare data.
To use the Cloud Healthcare API, you must create at least one dataset.

The following sample shows how to create a dataset named `my-dataset` in the
`us-central1` region. You use the dataset throughout this quickstart to
create DICOM stores, FHIR stores, and HL7v2 stores.

### REST

1. Create the dataset using the [`projects.locations.datasets.create`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets/create.md.txt) method.


   Before using any of the request data,
   make the following replacements:
   - `PROJECT_ID`: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)

   To send your request, choose one of these options:

   #### curl

   > [!NOTE]
   > **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


   Execute the following command:

   ```
   curl -X POST \
        -H "Authorization: Bearer $(gcloud auth print-access-token)" \
        -H "Content-Type: application/json; charset=utf-8" \
        -d "" \
        "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets?datasetId=my-dataset"
   ```

   #### PowerShell

   > [!NOTE]
   > **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


   Execute the following command:

   ```
   $cred = gcloud auth print-access-token
   $headers = @{ "Authorization" = "Bearer $cred" }

   Invoke-WebRequest `
       -Method POST `
       -Headers $headers `
       -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets?datasetId=my-dataset" | Select-Object -Expand Content
   ```

   #### APIs Explorer


   Open the

   [method reference page](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets/create.md.txt).
   The APIs Explorer panel opens on the right side of the page.
   You can interact with this tool to send requests.

   Complete any required fields and click **Execute**.

   The output is the following. The response contains an identifier for a [long-running operation](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.operations.md.txt) (LRO). Long-running operations are returned when method calls might take additional time to complete. Note the value of `OPERATION_ID`. You need this value in the next step.

   #### Response

   ```
   {
     "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID"
   }

   ```

   <br />

2. Get the status of the long-running operation using the [`projects.locations.datasets.operations.get`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.operations/get.md.txt) method.


   Before using any of the request data,
   make the following replacements:
   - `PROJECT_ID`: the ID of your Google Cloud project
   - `OPERATION_ID`: the ID returned from the long-running operation

   To send your request, choose one of these options:

   #### curl

   > [!NOTE]
   > **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


   Execute the following command:

   ```
   curl -X GET \
        -H "Authorization: Bearer $(gcloud auth print-access-token)" \
        "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/operations/OPERATION_ID"
   ```

   #### PowerShell

   > [!NOTE]
   > **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


   Execute the following command:

   ```
   $cred = gcloud auth print-access-token
   $headers = @{ "Authorization" = "Bearer $cred" }

   Invoke-WebRequest `
       -Method GET `
       -Headers $headers `
       -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/operations/OPERATION_ID" | Select-Object -Expand Content
   ```

   #### APIs Explorer


   Open the

   [method reference page](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.operations/get.md.txt).
   The APIs Explorer panel opens on the right side of the page.
   You can interact with this tool to send requests.

   Complete any required fields and click **Execute**.

   The output is the following. When the response contains `"done": true`, the long-running operation has finished.

   #### Response

   ```
   {
     "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID",
     "metadata": {
       "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata",
       "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.CreateDataset",
       "createTime": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
       "endTime": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
       "logsUrl": "https://console.cloud.google.com/CLOUD_LOGGING_URL"
       "counter": {
         "success": "SUCCESS_COUNT",
         // If there were any failures, they display in the `failure` field.
         "failure": "FAILURE_COUNT"
       }
     },
     "done": true,
     // The `response` field only displays if there were no errors.
     "response": {
       "@type": "type.googleapis.com/google.cloud.healthcare.v1.dataset.Dataset",
       "name": "projects/PROJECT_ID/locations/us-central1/datasets/my-dataset",
     },
     // If there were any errors, an `error` field displays instead of a `response` field.
     // See Troubleshooting long-running operations for a list of response codes.
     "error": {
       "code": ERROR_CODE,
       "message": "DESCRIPTION",
       "details": [
         {
           "@type": "...",
           FIELD1: ...,
           ...
         }
       ]
     }
   }
   ```

   <br />

<br />

To complete this quickstart, choose from one of the following sections:

- [Store and view a DICOM instance](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#store-and-view-dicom)
- [Store and view FHIR resources](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#store-and-view-fhir)
- [Store and view an HL7v2 message](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#store-and-view-hl7v2)

## Store and view a DICOM instance

This section shows how to complete the following tasks:

1. Create a DICOM store.
2. Store a DICOM instance in the DICOM store.
3. View the DICOM instance's metadata.

The Cloud Healthcare API implements the
[DICOMweb](https://www.dicomstandard.org/using/dicomweb)
standard to store and access medical imaging data.

### Create a DICOM store

DICOM stores exist inside datasets and hold DICOM instances. The following
sample shows how to create a DICOM store named `my-dicom-store`.

### REST

Create a DICOM store using the [`projects.locations.datasets.dicomStores.create`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.dicomStores/create.md.txt) method.


Before using any of the request data,
make the following replacements:

- `PROJECT_ID`: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)

To send your request, choose one of these options:

#### curl

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
curl -X POST \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     -H "Content-Type: application/json; charset=utf-8" \
     -d "" \
     "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores?dicomStoreId=my-dicom-store"
```

#### PowerShell

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores?dicomStoreId=my-dicom-store" | Select-Object -Expand Content
```

#### APIs Explorer


Open the

[method reference page](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.dicomStores/create.md.txt).
The APIs Explorer panel opens on the right side of the page.
You can interact with this tool to send requests.

Complete any required fields and click **Execute**.

You should receive a JSON response similar to the following:

#### Response

```
{
  "name": "projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store"
}
```

<br />

### Store a DICOM instance

1. Download the [sample DICOM instance file](https://docs.cloud.google.com/healthcare-api/docs/resources/dicom_00000001_000.dcm) to your machine.
   The file contains a de-identified patient X-ray.

   ### curl

   ```bash
   curl -O https://cloud.google.com/healthcare-api/docs/resources/dicom_00000001_000.dcm
   ```

   ### PowerShell

   ```bash
   Invoke-WebRequest -Uri "https://cloud.google.com/healthcare-api/docs/resources/dicom_00000001_000.dcm" -OutFile $pwd/dicom_00000001_000.dcm
   ```
2. Store the DICOM instance using the [`dicomStores.storeInstances`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.dicomStores/storeInstances.md.txt) method.
   This quickstart assumes you're running the command in the same directory
   where you downloaded the DICOM instance.


   ### REST


   Before using any of the request data,
   make the following replacements:
   - `PROJECT_ID`: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)

   To send your request, choose one of these options:

   #### curl

   > [!NOTE]
   > **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


   Execute the following command:

   ```
   curl -X POST \
        -H "Authorization: Bearer $(gcloud auth print-access-token)" \
        -H "Content-Type: application/dicom" \
        --data-binary @dicom_00000001_000.dcm \
        "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/studies"
   ```

   #### PowerShell

   > [!NOTE]
   > **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


   Execute the following command:

   ```
   $cred = gcloud auth print-access-token
   $headers = @{ "Authorization" = "Bearer $cred" }

   Invoke-WebRequest `
       -Method POST `
       -Headers $headers `
       -InFile dicom_00000001_000.dcm `
       -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/studies" | Select-Object -Expand Content
   ```

   The output is the following XML response. In this output:
   - `PROJECT_ID`, `us-central1`, `my-dataset`, `my-dicom-store`: the values you provided when running the command
   - `SOPClassUID`: uniquely identifies the Service-Object Pair (SOP) class
   - `SOPInstanceUID`: uniquely identifies the Service-Object Pair (SOP) instance
   - `STUDY_UID`: uniquely identifies the study instance
   - `SERIES_UID`: uniquely identifies the series instance
   - `INSTANCE_UID`: uniquely identifies the instance

   #### Response

   ```
   <NativeDicomModel>
     <DicomAttribute tag="00081190" vr="UR" keyword="RetrieveURL">
       <Value number="1">https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/studies/STUDY_UID</Value>
     </DicomAttribute>
     <DicomAttribute tag="00081199" vr="SQ" keyword="ReferencedSOPSequence">
       <Item number="1">
         <DicomAttribute tag="00081150" vr="UI" keyword="ReferencedSOPClassUID">
           <Value number="1">SOPClassUID</Value>
         </DicomAttribute>
         <DicomAttribute tag="00081155" vr="UI" keyword="ReferencedSOPInstanceUID">
           <Value number="1">SOPInstanceUID</Value>
         </DicomAttribute>
         <DicomAttribute tag="00081190" vr="UR" keyword="RetrieveURL">
           <Value number="1">https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/studies/STUDY_UID/series/SERIES_UID/instances/INSTANCE_UID</Value>
         </DicomAttribute>
       </Item>
     </DicomAttribute>
   </NativeDicomModel>
   ```

   <br />

   <br />

### View DICOM instance metadata

### REST

View the metadata for the instance using the [`dicomStores.searchForInstances`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.dicomStores/searchForInstances.md.txt) method.


Before using any of the request data,
make the following replacements:

- <var class="edit" scope="PROJECT_ID" translate="no">PROJECT_ID</var>: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)

To send your request, choose one of these options:

#### curl

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
curl -X GET \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/instances"
```

#### PowerShell

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/instances" | Select-Object -Expand Content
```

#### APIs Explorer


Open the

[method reference page](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.dicomStores/searchForInstances.md.txt).
The APIs Explorer panel opens on the right side of the page.
You can interact with this tool to send requests.

Complete any required fields and click **Execute**.

You should receive a JSON response similar to the following:

#### Response

```
[
   {
      "00080005":{
         "vr":"CS",
         "Value":[
            "CODE_STRING"
         ]
      },
      "00080016":{
         "vr":"UI",
         "Value":[
            "UNIQUE_IDENTIFIER"
         ]
      },
      "00080018":{
         "vr":"UI",
         "Value":[
            "UNIQUE_IDENTIFIER"
         ]
      },
      "00080020":{
         "vr":"DA",
         "Value":[
            "DATE_TIME"
         ]
      },
      "00080030":{
         "vr":"TM",
         "Value":[
            "TIME"
         ]
      },
      "00080060":{
         "vr":"CS",
         "Value":[
            "CODE_STRING"
         ]
      },
      "0008103E":{
         "vr":"LO",
         "Value":[
            "LONG_STRING"
         ]
      },
      "00100010":{
         "vr":"PN",
         "Value":[
            {
               "Alphabetic":"Anonymized"
            }
         ]
      },
   },
...
]
```

<br />

After storing and viewing the DICOM instance in the Cloud Healthcare API,
continue to [Clean up](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#clean-up) to avoid incurring charges to
your Google Cloud account for the resources used in this page.

For more information on working with DICOM data, see [What's next](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#dicom).

## Store and view FHIR resources

This section shows how to complete the following tasks:

1. Create a FHIR store.
2. Store a FHIR resource in the FHIR store.
3. View the FHIR resource's data.

The Cloud Healthcare API implements the [FHIR standard](https://docs.cloud.google.com/healthcare-api/docs/fhir.md.txt)
to store and access FHIR data.

### Create a FHIR store

FHIR stores exist inside datasets and contain FHIR resources. The following
sample shows how to create a FHIR store named `my-fhir-store` that uses
[FHIR version R4](https://hl7.org/fhir/R4/).

### REST

Create a FHIR store using the [`projects.locations.datasets.fhirStores.create`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores/create.md.txt) method.


Before using any of the request data,
make the following replacements:

- `PROJECT_ID`: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)


Request JSON body:

```
{
  "version": "R4"
}
```

To send your request, choose one of these options:

#### curl

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Save the request body in a file named `request.json`.
Run the following command in the terminal to create or overwrite
this file in the current directory:

```
cat > request.json << 'EOF'
{
  "version": "R4"
}
EOF
```


Then execute the following command to send your REST request:

```
curl -X POST \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     -H "Content-Type: application/json; charset=utf-8" \
     -d @request.json \
     "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores?fhirStoreId=my-fhir-store"
```

#### PowerShell

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Save the request body in a file named `request.json`.
Run the following command in the terminal to create or overwrite
this file in the current directory:

```
@'
{
  "version": "R4"
}
'@  | Out-File -FilePath request.json -Encoding utf8
```


Then execute the following command to send your REST request:

```
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/json; charset=utf-8" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores?fhirStoreId=my-fhir-store" | Select-Object -Expand Content
```

#### APIs Explorer


Copy the request body and open the

[method reference page](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores/create.md.txt).
The APIs Explorer panel opens on the right side of the page.
You can interact with this tool to send requests.

Paste the request body in this tool, complete any other required fields, and click **Execute**.

You should receive a JSON response similar to the following:

#### Response

```
{
  "name": "projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store",
  "version": "R4"
}
```

<br />

### Store a FHIR resource

### REST

Create a Patient resource in the FHIR store using the [`projects.locations.datasets.fhirStores.fhir.create`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/create.md.txt) method.


Before using any of the request data,
make the following replacements:

- `PROJECT_ID`: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)


Request JSON body:

```
{
  "name": [
    {
      "use": "official",
      "family": "Smith",
      "given": [
        "Darcy"
      ]
    }
  ],
  "gender": "female",
  "birthDate": "1970-01-01",
  "resourceType": "Patient"
}
```

To send your request, choose one of these options:

#### curl

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Save the request body in a file named `request.json`.
Run the following command in the terminal to create or overwrite
this file in the current directory:

```
cat > request.json << 'EOF'
{
  "name": [
    {
      "use": "official",
      "family": "Smith",
      "given": [
        "Darcy"
      ]
    }
  ],
  "gender": "female",
  "birthDate": "1970-01-01",
  "resourceType": "Patient"
}
EOF
```


Then execute the following command to send your REST request:

```
curl -X POST \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     -H "Content-Type: application/fhir+json" \
     -d @request.json \
     "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient"
```

#### PowerShell

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Save the request body in a file named `request.json`.
Run the following command in the terminal to create or overwrite
this file in the current directory:

```
@'
{
  "name": [
    {
      "use": "official",
      "family": "Smith",
      "given": [
        "Darcy"
      ]
    }
  ],
  "gender": "female",
  "birthDate": "1970-01-01",
  "resourceType": "Patient"
}
'@  | Out-File -FilePath request.json -Encoding utf8
```


Then execute the following command to send your REST request:

```
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/fhir+json" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient" | Select-Object -Expand Content
```

You should receive a JSON response similar to the following:

#### Response

```
{
  "birthDate": "1970-01-01",
  "gender": "female",
  "id": "PATIENT_ID",
  "meta": {
    "lastUpdated": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
    "versionId": "VERSION_ID"
  },
  "name": [
    {
      "family": "Smith",
      "given": [
        "Darcy"
      ],
      "use": "official"
    }
  ],
  "resourceType": "Patient"
}
```

<br />

### View FHIR resource contents

### REST

View information about the Patient resource using the
[`projects.locations.datasets.fhirStores.fhir.search`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/search.md.txt)
method.


Before using any of the request data,
make the following replacements:

- `PROJECT_ID`: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)

To send your request, choose one of these options:

#### curl

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
curl -X GET \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient"
```

#### PowerShell

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient" | Select-Object -Expand Content
```

You should receive a JSON response similar to the following:

```
{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient/PATIENT_ID",
      "resource": {
        "birthDate": "1970-01-01",
        "gender": "female",
        "id": "PATIENT_ID",
        "meta": {
          "lastUpdated": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "versionId": "MTY5MDQxMDk5ODU1OTkxNTAwMA"
        },
        "name": [
          {
            "family": "Smith",
            "given": [
              "Darcy"
            ],
            "use": "official"
          }
        ],
        "resourceType": "Patient"
      },
      "search": {
        "mode": "match"
      }
    }
  ],
  "link": [
    {
      "relation": "search",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient/?"
    },
    {
      "relation": "first",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient/?"
    },
    {
      "relation": "self",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient/?"
    }
  ],
  "resourceType": "Bundle",
  "total": 1,
  "type": "searchset"
}
```

<br />

After storing and viewing a FHIR resource in the Cloud Healthcare API,
continue to [Clean up](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#clean-up) to avoid incurring charges to
your Google Cloud account for the resources used in this page.

For more information on working with FHIR data, see [What's next](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#fhir).

## Store and view an HL7v2 message

This section shows how to complete the following tasks:

1. Create an HL7v2 store.
2. Store an HL7v2 message in the HL7v2 store.
3. View the HL7v2 message data.

The HL7v2 implementation in the Cloud Healthcare API aligns with the
[HL7v2 standard](https://www.hl7.org/implement/standards/product_brief.cfm?product_id=185).

### Create an HL7v2 store

HL7v2 stores exist inside datasets and hold HL7v2 messages. The following
sample shows how to create an HL7v2 store named `my-hl7v2-store`.

### REST

Create an HL7v2 store using the [`projects.locations.datasets.hl7V2Stores.create`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores/create.md.txt) method.


Before using any of the request data,
make the following replacements:

- `PROJECT_ID`: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)

To send your request, choose one of these options:

#### curl

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
curl -X POST \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     -H "Content-Type: application/json; charset=utf-8" \
     -d "" \
     "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores?hl7V2StoreId=my-hl7v2-store"
```

#### PowerShell

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores?hl7V2StoreId=my-hl7v2-store" | Select-Object -Expand Content
```

#### APIs Explorer


Open the

[method reference page](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7v2Stores/create).
The APIs Explorer panel opens on the right side of the page.
You can interact with this tool to send requests.

Complete any required fields and click **Execute**.

You should receive a JSON response similar to the following:

#### Response

```
{
  "name": "projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store"
}
```

<br />

### Create an HL7v2 message

1. Download the [sample HL7v2 message file](https://docs.cloud.google.com/static/healthcare-api/docs/resources/hl7v2-sample.json) to your machine:

   ### curl

   ```bash
   curl -O https://cloud.google.com/healthcare-api/docs/resources/hl7v2-sample.json
   ```

   ### PowerShell

   ```bash
   Invoke-WebRequest -Uri "https://cloud.google.com/healthcare-api/docs/resources/hl7v2-sample.json" -OutFile $pwd/hl7v2-sample.json
   ```

   The HL7v2 message contains the following information base-64 encoded in
   the `data` field of the sample file:

       MSH|^~\&|A|SEND_FACILITY|A|A|20180101000000||TYPE^A|20180101000000|T|0.0|||AA||00|ASCII
       EVN|A00|20180101040000
       PID||14^111^^^^MRN|11111111^^^^MRN~1111111111^^^^ORGNMBR

2. Store the HL7v2 message in the HL7v2 store using the [`projects.locations.datasets.hl7V2Stores.messages.create`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.messages/create.md.txt) method. This quickstart assumes you're
   running the command in the same directory where you downloaded the HL7v2 message.

   ### REST


   Before using any of the request data,
   make the following replacements:
   - `PROJECT_ID`: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)

   To send your request, choose one of these options:

   #### curl

   > [!NOTE]
   > **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


   Execute the following command:

   ```
   curl -X POST \
        -H "Authorization: Bearer $(gcloud auth print-access-token)" \
        -H "Content-Type: application/json; charset=utf-8" \
        --data-binary @hl7v2-sample.json \
        "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages"
   ```

   #### PowerShell

   > [!NOTE]
   > **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


   Execute the following command:

   ```
   $cred = gcloud auth print-access-token
   $headers = @{ "Authorization" = "Bearer $cred" }

   Invoke-WebRequest `
       -Method POST `
       -Headers $headers `
       -InFile hl7v2-sample.json `
       -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages" | Select-Object -Expand Content
   ```

   #### APIs Explorer


   Open the

   [method reference page](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.messages/create.md.txt).
   The APIs Explorer panel opens on the right side of the page.
   You can interact with this tool to send requests.

   Complete any required fields and click **Execute**.

   The output is the following. In this output:
   - `PROJECT_ID`, `us-central1`, `my-dataset`, `my-hl7v2-store`: the values you provided in the method call
   - `MESSAGE_ID`: an identifier for the HL7v2 message provided by the Cloud Healthcare API. Note the value of `MESSAGE_ID`. You need this value in the next step.

   #### Response

   ```
   {
     "name": "projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages/MESSAGE_ID",
     "data": "TVNIfF5+XCZ8QXxTRU5EX0ZBQ0lMSVRZfEF8QXwyMDE4MDEwMTAwMDAwMHx8VFlQRV5BfDIwMTgwMTAxMDAwMDAwfFR8MC4wfHx8QUF8fDAwfEFTQ0lJDUVWTnxBMDB8MjAxODAxMDEwNDAwMDANUElEfHwxNAExMTFeXl5eTVJOfDExMTExMTExXl5eXk1STn4xMTExMTExMTExXl5eXk9SR05NQlI=",
     "sendFacility": "SEND_FACILITY",
     "sendTime": "2018-01-01T00:00:00Z",
     "messageType": "TYPE",
     "createTime": "1970-01-01T00:00:00Z",
     "patientIds": [
       {
         "value": "14\u0001111",
         "type": "MRN"
       },
       {
         "value": "11111111",
         "type": "MRN"
       },
       {
         "value": "1111111111",
         "type": "ORGNMBR"
       }
     ]
   }
   ```

### View HL7v2 message contents

Find the `MESSAGE_ID` in the response you received when you created
the HL7v2 message.

### REST

View the HL7v2 message details using the [`projects.locations.datasets.hl7V2stores.messages.get`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.messages/get.md.txt) method.


Before using any of the request data,
make the following replacements:

- `PROJECT_ID`: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)
- `HL7V2_MESSAGE_ID`: the ID in the response you received when you created the HL7v2 message

To send your request, choose one of these options:

#### curl

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
curl -X GET \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages/HL7V2_MESSAGE_ID"
```

#### PowerShell

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages/HL7V2_MESSAGE_ID" | Select-Object -Expand Content
```

#### APIs Explorer


Open the

[method reference page](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.messages/get.md.txt).
The APIs Explorer panel opens on the right side of the page.
You can interact with this tool to send requests.

Complete any required fields and click **Execute**.

You should receive a JSON response similar to the following:

#### Response

```
{
  "name": "projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages/MESSAGE_ID",
  "data": "TVNIfF5+XCZ8QXxTRU5EX0ZBQ0lMSVRZfEF8QXwyMDE4MDEwMTAwMDAwMHx8VFlQRV5BfDIwMTgwMTAxMDAwMDAwfFR8MC4wfHx8QUF8fDAwfEFTQ0lJDUVWTnxBMDB8MjAxODAxMDEwNDAwMDANUElEfHwxNAExMTFeXl5eTVJOfDExMTExMTExXl5eXk1STn4xMTExMTExMTExXl5eXk9SR05NQlI=",
  "sendFacility": "SEND_FACILITY",
  "sendTime": "2018-01-01T00:00:00Z",
  "messageType": "TYPE",
  "createTime": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
  "patientIds": [
    {
      "value": "14\u0001111",
      "type": "MRN"
    },
    {
      "value": "11111111",
      "type": "MRN"
    },
    {
      "value": "1111111111",
      "type": "ORGNMBR"
    }
  ],
  "parsedData": {
    "segments": [
      {
        "segmentId": "MSH",
        "fields": {
          "8.2": "A",
          "11": "0.0",
          "8.1": "TYPE",
          "4": "A",
          "9": "20180101000000",
          "10": "T",
          "17": "ASCII",
          "14": "AA",
          "1": "^~\\&",
          "2": "A",
          "3": "SEND_FACILITY",
          "5": "A",
          "16": "00",
          "0": "MSH",
          "6": "20180101000000"
        }
      },
      {
        "segmentId": "EVN",
        "fields": {
          "0": "EVN",
          "1": "A00",
          "2": "20180101040000"
        }
      },
      {
        "segmentId": "PID",
        "fields": {
          "2.5": "MRN",
          "3[0].1": "11111111",
          "3[0].5": "MRN",
          "3[1].1": "1111111111",
          "3[1].5": "ORGNMBR",
          "0": "PID",
          "2.1": "14\u0001111"
        }
      }
    ]
  }
}
```

<br />

After storing and viewing the HL7v2 message in the Cloud Healthcare API,
continue to [Clean up](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#clean-up) to avoid incurring charges to
your Google Cloud account for the resources used in this page.

For more information on working with HL7v2 data, see [What's next](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#hl7v2).

## Clean up


To avoid incurring charges to your Google Cloud account for
the resources used on this page, delete the Google Cloud project with the
resources.

If you created a new project for this quickstart,
follow the steps in [Delete the project](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#delete-project). Otherwise, follow the
steps in [Delete the dataset](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#delete-dataset).


Optional: Revoke credentials from the gcloud CLI.

```bash
gcloud auth revoke
```

### Delete the project

> [!CAUTION]
> **Caution** : Deleting a project has the following effects:
>
> - **Everything in the project is deleted.** If you used an existing project for the tasks in this document, when you delete it, you also delete any other work you've done in the project.
> - **Custom project IDs are lost.** When you created this project, you might have created a custom project ID that you want to use in the future. To preserve the URLs that use the project ID, such as an `appspot.com` URL, delete selected resources inside the project instead of deleting the whole project.
>
>
> If you plan to explore multiple architectures, tutorials, or quickstarts, reusing projects
> can help you avoid exceeding project quota limits.

1. Delete a Google Cloud project:

```
gcloud projects delete PROJECT_ID
```

<br />

### Delete the dataset

If you no longer need the dataset created in this quickstart, you can delete
it. Deleting a dataset permanently deletes the dataset and any FHIR,
HL7v2, or DICOM stores it contains.

### REST

Delete the dataset using the [`projects.locations.datasets.delete`](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets/delete.md.txt) method.


Before using any of the request data,
make the following replacements:

- `PROJECT_ID`: the ID of the Google Cloud project that you created or selected in [Before you begin](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#before-you-begin)

To send your request, choose one of these options:

#### curl

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
curl -X DELETE \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset"
```

#### PowerShell

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method DELETE `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset" | Select-Object -Expand Content
```

#### APIs Explorer


Open the

[method reference page](https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets/delete.md.txt).
The APIs Explorer panel opens on the right side of the page.
You can interact with this tool to send requests.

Complete any required fields and click **Execute**.

You should receive a successful status code (2xx) and an empty response.

<br />

## How did it go?

<button class="button button-blue expand-control gc-analytics-event" data-category="Quickstart" data-action="Feedback" data-label="Cloud Healthcare API, Cloud Healthcare API" data-value="1" track-type="quickstart" track-name="feedbackLink" track-metadata-position="steps" track-metadata-end-goal="itWorked"> It worked! </button>

> [!TIP]
> **Great!** What did you like about the quickstart? What could we have done better? [Let us know!](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#).

<button class="button expand-control gc-analytics-event" data-category="Quickstart" data-action="Feedback" data-label="Cloud Healthcare API, Cloud Healthcare API" data-value="0" style="position: absolute; top: 0; left: 110px;" track-type="quickstart" track-name="feedbackLink" track-metadata-position="steps" track-metadata-end-goal="itFailed"> I got stuck. </button>

> [!WARNING]
> **We're sorry to hear that.** [Let us know what went wrong](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-rest.md.txt#). We'll want to fix it.

## What's next

See the following sections for general information on the Cloud Healthcare API
and how to perform the tasks in this quickstart using another interface:

- Read an [overview of Cloud Healthcare API concepts](https://docs.cloud.google.com/healthcare-api/docs/concepts/introduction)
- [Store healthcare data with client libraries](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-client-library.md.txt)
- [Store healthcare data with the Google Cloud console](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-console.md.txt)
- [Store healthcare data with the gcloud CLI](https://docs.cloud.google.com/healthcare-api/docs/store-healthcare-data-gcloud.md.txt)

### DICOM

- [Create and manage DICOM stores](https://docs.cloud.google.com/healthcare-api/docs/how-tos/dicom.md.txt)
- [Connect a PACS to the Cloud Healthcare API](https://docs.cloud.google.com/healthcare-api/docs/how-tos/dicom-connect-pacs.md.txt)
- [Use the DICOMweb standard](https://docs.cloud.google.com/healthcare-api/docs/how-tos/dicomweb.md.txt)
- [Import and export DICOM data using Cloud Storage](https://docs.cloud.google.com/healthcare-api/docs/how-tos/dicom-import-export.md.txt)

See the [DICOM conformance statement](https://docs.cloud.google.com/healthcare-api/docs/dicom.md.txt) for information on
how the Cloud Healthcare API implements the DICOMweb standard.

### FHIR

- [Create and manage FHIR stores](https://docs.cloud.google.com/healthcare-api/docs/how-tos/fhir.md.txt)
- [Create and manage FHIR resources](https://docs.cloud.google.com/healthcare-api/docs/how-tos/fhir-resources.md.txt)
- [Import and export FHIR data using Cloud Storage](https://docs.cloud.google.com/healthcare-api/docs/how-tos/fhir-import-export.md.txt)

See the [FHIR conformance statement](https://docs.cloud.google.com/healthcare-api/docs/fhir.md.txt) for information on
how the Cloud Healthcare API implements the FHIR standard.

### HL7v2

- [Create and manage HL7v2 stores](https://docs.cloud.google.com/healthcare-api/docs/how-tos/hl7v2.md.txt)
- [Create and manage HL7v2 messages](https://docs.cloud.google.com/healthcare-api/docs/how-tos/hl7v2-messages.md.txt)
- [Transmit HL7v2 messages over TCP/IP connections](https://docs.cloud.google.com/healthcare-api/docs/how-tos/mllp-adapter.md.txt)
- [Import and export HL7v2 messages using Cloud Storage](https://docs.cloud.google.com/healthcare-api/docs/how-tos/hl7v2-import-export)