Velge formatering av responsen i XML eller JSON
Konsument kan velge om resultatsettet blir formatert enten som XML eller JSON ved bruk av Accept-header. Accept-header kan også inneholde FHIR-versjon som etterspørres
Tillatte verdier for Accept-header:
- "application/fhir+json"
- "application/fhir+xml"
- "application/fhir+json;fhirVersion=4.0"
- "application/fhir+xml;fhirVersion=4.0"
Enkel sjekkliste:
- sjekk at nødvendige headers
Content-TypeogAccepter definert
HEADERS
| Header | Eksempel på verdi | Beskrivelse |
|---|---|---|
Accept |
application/fhir+xml;fhirVersion=4.0 | Accept-header spesifiserer formatet av responsen (JSON/XML) |
Content-Type |
application/fhir+xml;fhirVersion=4.0 | Content-Type-header kreves ved request |
Request JSON
GET /persontjenesten/fhir/metadata HTTP/1.1
Host: api.et.grunndata.helsepunkt.no
Accept: application/fhir+json;fhirVersion=4.0
Content-Type: application/fhir+json;fhirVersion=4.0
Request XML
GET /persontjenesten/fhir/metadata HTTP/1.1
Host: api.et.grunndata.helsepunkt.no
Accept: application/fhir+xml;fhirVersion=4.0
Content-Type: application/fhir+xml;fhirVersion=4.0
Respons
Statuscode: 200 OK
Respons i JSON-format
{
"resourceType": "CapabilityStatement",
"id": "4f6e6ba8-9f9d-48a5-92eb-9737b5d26788",
"meta": {
"versionId": "609dc554-2123-480e-a793-2b1345901b6d",
"lastUpdated": "2021-01-22T11:14:49.5888703+00:00"
},
"language": "en-US",
"url": "metadata",
"version": "1.0",
"name": "Vonk FHIR server 3.9.1 CapabilityStatement",
"status": "active",
...
}
```
Statuscode: 200 OK
```
Respons i XML-format
<CapabilityStatement xmlns="http://hl7.org/fhir"> <id value="4f6e6ba8-9f9d-48a5-92eb-9737b5d26788" /> <meta> <versionId value="609dc554-2123-480e-a793-2b1345901b6d" /> <lastUpdated value="2021-01-22T11:14:49.5888703+00:00" /> </meta> <language value="en-US" /> <url value="metadata" /> <version value="1.0" /> <name value="Vonk FHIR server 3.9.1 CapabilityStatement" /> <status value="active" /> ... </CapabilityStatement>