Convert C-CDA to FHIR R4
curl --request POST \
--url https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir \
--header 'Content-Type: application/xml' \
--header 'x-api-key: <api-key>' \
--data '<string>'import requests
url = "https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir"
payload = "<string>"
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/xml"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/xml'},
body: '<string>'
};
fetch('https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"Content-Type: application/xml",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/xml")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/xml")
.body("<string>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/xml'
request.body = "<string>"
response = http.request(request)
puts response.read_bodyC-CDA
Convert C-CDA to FHIR R4
Converts the provided C-CDA document to a FHIR R4 Bundle.
POST
/
convert
/
v1
/
ccda
/
to
/
fhir
Convert C-CDA to FHIR R4
curl --request POST \
--url https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir \
--header 'Content-Type: application/xml' \
--header 'x-api-key: <api-key>' \
--data '<string>'import requests
url = "https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir"
payload = "<string>"
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/xml"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/xml'},
body: '<string>'
};
fetch('https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"Content-Type: application/xml",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/xml")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/xml")
.body("<string>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.metriport.com/convert/v1/ccda/to/fhir")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/xml'
request.body = "<string>"
response = http.request(request)
puts response.read_bodyBody
xml
required
A valid C-CDA (R2.1) XML document.
<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3">
<!-- contents -->
</ClinicalDocument>
You can use this example C-CDA from HL7 for testing purposes.
Query Params
Your internal identifier for the patient that the provided C-CDA document corresponds to.
This will be used to populated the patient-related references in the returned FHIR Bundle.
Response
Returns a FHIR R4 Bundle of typebatch with the
entry containing an array of FHIR R4 Resources being the outcome of the conversion.
{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"fullUrl": "urn:uuid:adc44b9c-3083-396f-877f-463120f6b26a",
"resource": {
"resourceType": "Location",
"id": "adc44b9c-3083-396f-877f-463120f6b26a",
"name": "Good Health Urgent Care",
"address": {
"line": [
"1007 Health Drive"
],
"city": "Portland",
"state": "OR",
"country": "US",
"postalCode": "99123"
},
"telecom": [
{
"system": "phone",
"value": "+1(555)555-1030",
"use": "work"
}
],
"type": [
{
"coding": [
{
"code": "1160-1",
"display": "Urgent Care Center",
"system": "urn:oid:2.16.840.1.113883.6.259"
}
]
}
]
},
"request": {
"method": "PUT",
"url": "Location/adc44b9c-3083-396f-877f-463120f6b26a"
}
},
{
"fullUrl": "urn:uuid:7134ccce-d097-300c-a811-e4d2fc04a4c7",
"resource": {
"resourceType": "Immunization",
"id": "7134ccce-d097-300c-a811-e4d2fc04a4c7",
"identifier": [
{
"system": "urn:ietf:rfc:3986",
"value": "urn:uuid:e6f1ba43-c0ed-4b9b-9f12-f435d8ad8f92"
}
],
"occurrenceDateTime": "1998-12-15",
"vaccineCode": {
"coding": [
{
"code": "88",
"display": "Influenza virus vaccine",
"system": "http://hl7.org/fhir/sid/cvx"
}
]
},
"lotNumber": "1",
"manufacturer": {
"display": "Health LS - Immuno Inc."
},
"doseQuantity": {
"value": "50",
"unit": "ug",
"system": "http://unitsofmeasure.org"
},
"status": "completed",
"route": {
"coding": [
{
"code": "C28161",
"display": "Intramuscular injection",
"system": "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl"
}
]
},
"patient": {
"reference": "Patient/123"
}
},
"request": {
"method": "PUT",
"url": "Immunization/7134ccce-d097-300c-a811-e4d2fc04a4c7"
}
},
]
}
⌘I

