Access the Azure Health Data Services with cURL

In this article, you learn how to access Azure Health Data Services with cURL.

Prerequisites

PowerShell

CLI

Obtain Azure Access Token

Before accessing the Azure Health Data Services, you must grant the user or client app with proper permissions. For more information on how to grant permissions, see Azure Health Data Services authorization.

There are several different ways to obtain an Azure access token for the Azure Health Data Services.

Note

Make sure that you have logged into Azure and that you are in the Azure subscription and tenant where you have deployed the Azure Health Data Services instance.

### check Azure environment and PowerShell versions
Get-AzContext 
Set-AzContext -Subscription <subscriptionid>
$PSVersionTable.PSVersion
Get-InstalledModule -Name Az -AllVersions
curl --version

### get access token for the FHIR service
$fhirservice="https://<fhirservice>.fhir.azurehealthcareapis.com"
$token=(Get-AzAccessToken -ResourceUrl $fhirservice).Token

### Get access token for the DICOM service
$dicomtokenurl= "https://dicom.healthcareapis.azure.com/"
$token=$( Get-AzAccessToken -ResourceUrl $dicomtokenurl).Token

Note

When the FHIR® service audience parameter is not mapped to the FHIR service endpoint url, the resource parameter value should be mapped to Audience value under the FHIR Service Authentication blade.

Access data in the FHIR service

$fhirservice="https://<fhirservice>.fhir.azurehealthcareapis.com"

curl -X GET --header "Authorization: Bearer $token" $fhirservice/Patient

Access data in the FHIR service with curl script.

Access data in the DICOM service

$dicomservice="https://<dicomservice>.dicom.azurehealthcareapis.com"

curl -X GET --header "Authorization: Bearer $token" $dicomservice/changefeed?includemetadata=false

Access data in the DICOM service with curl script.

Next steps

In this article, you learned how to access Azure Health Data Services data using cURL.

To learn about how to access Azure Health Data Services data using REST Client extension in Visual Studio Code, see

Note

FHIR® is a registered trademark of HL7 and is used with the permission of HL7.