Skip to content

Instantly share code, notes, and snippets.

@mathyousee
Last active April 1, 2023 03:34
Show Gist options
  • Save mathyousee/3678a14fe5599cb9526428b9e1a6ed24 to your computer and use it in GitHub Desktop.
Save mathyousee/3678a14fe5599cb9526428b9e1a6ed24 to your computer and use it in GitHub Desktop.
Dataverse Healthcare API Samples

Details for the HTTP call for authenticating to Dataverse

Method: POST

URI: https://login.microsoftonline.com/fancytenantid/oauth2/token

Headers

{
  "Content-Type": "application/x-www-form-urlencoded"
}

Body

grant_type=client_credentials&
client_id=fancyclientid&
client_secret=fancyclientsecret&
resource=https://fancydataverse.crm.dynamics.com/

How to use this

Update the fancytenantid, fancyclientid, fancyclientsecret, and fancydataverse placeholders with your own values.

URIs for the FHIR API in Dataverse

These APIs are available to authenticated users or applications to use FHIR bundles directly with the Dataverse API.

URIs and format

Upsert: https://fancydataverse.crm.dynamics.com/api/data/v9.1/msind_UpsertBundle

Retrieve: https://fancydataverse.crm.dynamics.com/api/data/v9.1/msind_RetrieveBundle

HTTP Headers

{
  "OData-MaxVersion": "4.0",
  "OData-Version": "4.0",
  "Content-Type": "application/json; charset=utf-8 ",
  "Authorization": "Bearer @{outputs('Compose_-_Bearer_Token')}"
}

How to use this

Replace the fancydataverse placeholder in the URL with the desired environment.

Ensure that the Authorization header references the correct variable with your Authorization bearer token: @{outputs('Compose_-_Bearer_Token')

{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"resource": {
"resourceType": "Patient",
"id": "f5e7ee94-bfc6-465e-a64d-f0c90e3d50f5",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Generated by <a href=\"https://github.com/synthetichealth/synthea\">Synthea</a>.Version identifier: v2.5.0-1-g8c92315\n . Person seed: 9119972216875908855 Population seed: 1597864402061</div>"
},
"name": [
{
"use": "official",
"family": "Runolfsson901",
"given": [
"Adolph80"
],
"prefix": [
"Mr."
]
}
],
"telecom": [
{
"system": "phone",
"value": "555-534-7756",
"use": "home"
}
],
"gender": "male",
"birthDate": "1957-01-10",
"address": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/geolocation",
"extension": [
{
"url": "latitude",
"valueDecimal": 41.67935057564304
},
{
"url": "longitude",
"valueDecimal": -71.12113264067766
}
]
}
],
"line": [
"268 VonRueden Ferry Unit 3"
],
"city": "Fall River",
"state": "Massachusetts",
"postalCode": "02724",
"country": "US"
}
],
"multipleBirthBoolean": false
},
"request": {
"method": "POST",
"url": "Patient"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment