Per the specification, a client can ask a server to generate a fully bundled document from a composition resource. I’ve pulled together a Postman to help demonstrate this feature on the IBM FHIR Server.
- Download the Postman
2. Update the SERVER_HOSTNAME
3. Update the Authorization for your username and password
4. Click Tests > Run
5. Click Run

6. You’ll see the tests run.

7. Click on the Tests of Interest, and then check the curl you are interested, such as:
curl --location --request GET 'https://localhost:9443/fhir-server/api/v4/Composition/17b83b99f91-3c0d6274-0498-4fe4-999e-ba8574f85b09/$document?persist=true' \
--header 'Content-Type: application/fhir+json' \
--header 'Authorization: Basic .....'
Good Luck with Composition/$document.
{ | |
"info": { | |
"_postman_id": "6c0a89ea-117d-4d1a-a323-655832225d62", | |
"name": "IBM FHIR Server - Composition/$document", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" | |
}, | |
"item": [ | |
{ | |
"name": "PREP - Create Practitioner", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"pm.test(\"Status code (200,201)\", function () {", | |
" pm.response.to.have.status(200) || ", | |
" pm.response.to.have.status(201);", | |
"});" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"method": "PUT", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"value": "application/fhir+json", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"resourceType\": \"Practitioner\",\n \"id\": \"17b83b98f73-8c735502-4c97-435a-84b9-f8d7a35f1965\",\n \"text\": {\n \"status\": \"generated\",\n \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">Assigned, Amanda. SSN:\\n 33344444</div>\"\n },\n \"identifier\": [\n {\n \"type\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n \"code\": \"SB\"\n }\n ]\n },\n \"system\": \"http://hl7.org/fhir/sid/us-ssn\",\n \"value\": \"33344444\"\n }\n ],\n \"name\": [\n {\n \"use\": \"official\",\n \"family\": \"Assigned\",\n \"given\": [\n \"Amanda\"\n ]\n }\n ],\n \"telecom\": [\n {\n \"system\": \"phone\",\n \"value\": \"555-555-1021\",\n \"use\": \"work\"\n }\n ],\n \"address\": [\n {\n \"use\": \"home\",\n \"line\": [\n \"1020 Healthcare Drive\"\n ]\n }\n ],\n \"gender\": \"female\"\n}" | |
}, | |
"url": { | |
"raw": "https://{{SERVER_HOSTNAME}}/fhir-server/api/v4/Practitioner/17b83b98f73-8c735502-4c97-435a-84b9-f8d7a35f1965", | |
"protocol": "https", | |
"host": [ | |
"{{SERVER_HOSTNAME}}" | |
], | |
"path": [ | |
"fhir-server", | |
"api", | |
"v4", | |
"Practitioner", | |
"17b83b98f73-8c735502-4c97-435a-84b9-f8d7a35f1965" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "PREP - Create Patient", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"pm.test(\"Status code (200,201)\", function () {", | |
" pm.response.to.have.status(200) || ", | |
" pm.response.to.have.status(201);", | |
"});" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"method": "PUT", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"value": "application/fhir+json", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"resourceType\": \"Patient\",\n \"id\": \"17b83b99648-9ef5f08c-d2d5-4a3a-a930-ce45dc2ecaea\",\n \"meta\": {\n \"versionId\": \"1\",\n \"lastUpdated\": \"2021-08-26T18:29:43.113072Z\"\n },\n \"name\": [\n {\n \"family\": \"Doe\",\n \"given\": [\n \"John\"\n ]\n }\n ],\n \"telecom\": [\n {\n \"system\": \"phone\",\n \"value\": \"555-1122\",\n \"use\": \"home\"\n }\n ],\n \"birthDate\": \"1970-01-01\",\n \"generalPractitioner\": [\n {\n \"reference\": \"Practitioner/17b83b98f73-8c735502-4c97-435a-84b9-f8d7a35f1965\"\n }\n ]\n}" | |
}, | |
"url": { | |
"raw": "https://{{SERVER_HOSTNAME}}/fhir-server/api/v4/Patient/17b83b99648-9ef5f08c-d2d5-4a3a-a930-ce45dc2ecaea", | |
"protocol": "https", | |
"host": [ | |
"{{SERVER_HOSTNAME}}" | |
], | |
"path": [ | |
"fhir-server", | |
"api", | |
"v4", | |
"Patient", | |
"17b83b99648-9ef5f08c-d2d5-4a3a-a930-ce45dc2ecaea" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "PREP - Create Observation", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"pm.test(\"Status code (200,201)\", function () {", | |
" pm.response.to.have.status(200) || ", | |
" pm.response.to.have.status(201);", | |
"});" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"method": "PUT", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"value": "application/fhir+json", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"resourceType\": \"Observation\",\n \"id\": \"17b83b99d35-37c44949-7876-4705-8df1-15792f2b05a8\",\n \"meta\": {\n \"versionId\": \"1\",\n \"lastUpdated\": \"2021-08-26T18:29:44.885634Z\"\n },\n \"status\": \"final\",\n \"category\": [\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n \"code\": \"vital-signs\",\n \"display\": \"Vital Signs\"\n }\n ]\n }\n ],\n \"code\": {\n \"coding\": [\n {\n \"system\": \"http://loinc.org\",\n \"code\": \"55284-4\",\n \"display\": \"Blood pressure systolic and diastolic\"\n }\n ],\n \"text\": \"BP\"\n },\n \"subject\": {\n \"reference\": \"Patient/17b83b99648-9ef5f08c-d2d5-4a3a-a930-ce45dc2ecaea\"\n },\n \"component\": [\n {\n \"code\": {\n \"coding\": [\n {\n \"system\": \"http://loinc.org\",\n \"code\": \"8459-0\",\n \"display\": \"Systolic blood pressure--sitting\"\n }\n ]\n },\n \"valueQuantity\": {\n \"value\": 125.0,\n \"unit\": \"mmHg\"\n }\n },\n {\n \"code\": {\n \"coding\": [\n {\n \"system\": \"http://loinc.org\",\n \"code\": \"8453-3\",\n \"display\": \"BP dias--sitting\"\n }\n ]\n },\n \"valueQuantity\": {\n \"value\": 80.0,\n \"unit\": \"mmHg\"\n }\n }\n ]\n}" | |
}, | |
"url": { | |
"raw": "https://{{SERVER_HOSTNAME}}/fhir-server/api/v4/Observation/17b83b99d35-37c44949-7876-4705-8df1-15792f2b05a8", | |
"protocol": "https", | |
"host": [ | |
"{{SERVER_HOSTNAME}}" | |
], | |
"path": [ | |
"fhir-server", | |
"api", | |
"v4", | |
"Observation", | |
"17b83b99d35-37c44949-7876-4705-8df1-15792f2b05a8" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "PREP - Create Composition", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"pm.test(\"Status code (200,201)\", function () {", | |
" pm.response.to.have.status(200) || ", | |
" pm.response.to.have.status(201);", | |
"});" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"method": "PUT", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"value": "application/fhir+json", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"resourceType\": \"Composition\",\n \"id\":\"17b83b99f91-3c0d6274-0498-4fe4-999e-ba8574f85b09\",\n \"status\": \"final\",\n \"type\": {\n \"coding\": [\n {\n \"system\": \"http://somesystem.org\",\n \"code\": \"somecode-1234\"\n }\n ]\n },\n \"subject\": {\n \"reference\": \"Patient/17b83b99648-9ef5f08c-d2d5-4a3a-a930-ce45dc2ecaea\"\n },\n \"date\": \"2015-02-14T13:42:00+10:00\",\n \"author\": [\n {\n \"reference\": \"Practitioner/17b83b98f73-8c735502-4c97-435a-84b9-f8d7a35f1965\"\n }\n ],\n \"title\": \"This is the title\",\n \"section\": [\n {\n \"entry\": [\n {\n \"reference\": \"Observation/17b83b99d35-37c44949-7876-4705-8df1-15792f2b05a8\"\n }\n ]\n }\n ]\n}" | |
}, | |
"url": { | |
"raw": "https://{{SERVER_HOSTNAME}}/fhir-server/api/v4/Composition/17b83b99f91-3c0d6274-0498-4fe4-999e-ba8574f85b09", | |
"protocol": "https", | |
"host": [ | |
"{{SERVER_HOSTNAME}}" | |
], | |
"path": [ | |
"fhir-server", | |
"api", | |
"v4", | |
"Composition", | |
"17b83b99f91-3c0d6274-0498-4fe4-999e-ba8574f85b09" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "1. Execute Composition/$document with Persist", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"pm.test(\"Status code (200)\", function () {", | |
" pm.response.to.have.status(200);", | |
"});", | |
"", | |
"pm.test(\"Check that there is no headerlocation\", function () {", | |
" pm.expect(pm.response.headers.has('Location'));", | |
" var headerLocation=postman.getResponseHeader(\"Location\");", | |
" pm.collectionVariables.set(\"HEADER_LOCATION\", headerLocation);", | |
"});" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"value": "application/fhir+json", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "https://{{SERVER_HOSTNAME}}/fhir-server/api/v4/Composition/17b83b99f91-3c0d6274-0498-4fe4-999e-ba8574f85b09/$document?persist=true", | |
"protocol": "https", | |
"host": [ | |
"{{SERVER_HOSTNAME}}" | |
], | |
"path": [ | |
"fhir-server", | |
"api", | |
"v4", | |
"Composition", | |
"17b83b99f91-3c0d6274-0498-4fe4-999e-ba8574f85b09", | |
"$document" | |
], | |
"query": [ | |
{ | |
"key": "persist", | |
"value": "true" | |
} | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "2. Get Persisted Composition Bundle", | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"value": "application/fhir+json", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{HEADER_LOCATION}}", | |
"host": [ | |
"{{HEADER_LOCATION}}" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "3. Execute Composition/$document Copy", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"pm.test(\"Status code (200)\", function () {", | |
" pm.response.to.have.status(200);", | |
"});", | |
"", | |
"pm.test(\"Check that there is no headerlocation\", function () {", | |
" pm.expect(pm.response.headers.get('Location')).undefined;", | |
"});" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"value": "application/fhir+json", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "https://{{SERVER_HOSTNAME}}/fhir-server/api/v4/Composition/17b83b99f91-3c0d6274-0498-4fe4-999e-ba8574f85b09/$document?persist=false", | |
"protocol": "https", | |
"host": [ | |
"{{SERVER_HOSTNAME}}" | |
], | |
"path": [ | |
"fhir-server", | |
"api", | |
"v4", | |
"Composition", | |
"17b83b99f91-3c0d6274-0498-4fe4-999e-ba8574f85b09", | |
"$document" | |
], | |
"query": [ | |
{ | |
"key": "persist", | |
"value": "false" | |
} | |
] | |
} | |
}, | |
"response": [] | |
} | |
], | |
"auth": { | |
"type": "basic", | |
"basic": [ | |
{ | |
"key": "password", | |
"value": "", | |
"type": "string" | |
}, | |
{ | |
"key": "username", | |
"value": "fhiruser", | |
"type": "string" | |
} | |
] | |
}, | |
"event": [ | |
{ | |
"listen": "prerequest", | |
"script": { | |
"type": "text/javascript", | |
"exec": [ | |
"" | |
] | |
} | |
}, | |
{ | |
"listen": "test", | |
"script": { | |
"type": "text/javascript", | |
"exec": [ | |
"" | |
] | |
} | |
} | |
], | |
"variable": [ | |
{ | |
"key": "SERVER_HOSTNAME", | |
"value": "localhost:9443" | |
}, | |
{ | |
"key": "HEADER_LOCATION", | |
"value": "" | |
} | |
] | |
} |