Examples

Create a new patient record

This example demonstrates how to create a new patient record.

    1. Generate an access token by following the OAuth 2.0 walkthrough

      1. The example below assumes you have been granted an access token of: eyJhbGxxxx

    2. Confirm the ID of the Organization

      1. The example below assumes you have an ID of: 235a397b-1ae8-4755-9c77-1a0e2fbc5314

    1. Confirm the contents of the Patient resource

    2. Make the call as detailed below, replacing the access token, organisation ID and Patient resource with your own values

Success

Example request

This example is written for sandbox.patientsknowbest.com; replace the URL as needed if you are connecting to a different environment.

Note: whilst every effort has been made to ensure that the examples are correct and useful, they do not form part of the official specification.

curl -X POST --header "Accept: application/fhir+json" --header "Content-Type: application/fhir+json" --header "Authorization: Bearer eyJhbGxxxx" --header "X-Org-Public-Id: 235a397b-1ae8-4755-9c77-1a0e2fbc5314" "https://sandbox.patientsknowbest.com/phr-fhir/Patient/$process-message" --data "{ \"resourceType\": \"Patient\", \"identifier\": [{ \"extension\": [{ \"url\": \"https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-NHSNumberVerificationStatus-1\", \"valueCodeableConcept\": { \"coding\": [{ \"system\": \"https://fhir.hl7.org.uk/STU3/CodeSystem/CareConnect-NHSNumberVerificationStatus-1\", \"code\": \"01\" }] } }], \"system\": \"https://fhir.nhs.uk/Id/nhs-number\", \"value\": \"9999999999\" }], \"name\": [{ \"family\": \"Doe\", \"given\": [\"John\"], \"prefix\": [\"Mr\"] }], \"telecom\": [ { \"system\": \"phone\", \"value\": \"07123456789\" }, { \"system\": \"email\", \"value\": \"john.smith@example.com\" } ], \"gender\": \"male\", \"birthDate\": \"1990-01-02\", \"address\": [{ \"line\": [\"1 Main Street\", \"The Place\"], \"city\": \"London\", \"postalCode\": \"CB11BC\" }] }"

Pretty-printed request body

{

"resourceType": "Patient",

"identifier": [{

"extension": [{

"url": "https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-NHSNumberVerificationStatus-1",

"valueCodeableConcept": {

"coding": [{

"system": "https://fhir.hl7.org.uk/STU3/CodeSystem/CareConnect-NHSNumberVerificationStatus-1",

"code": "01"

}]

}

}],

"system": "https://fhir.nhs.uk/Id/nhs-number",

"value": "9999999999"

}],

"name": [{

"family": "Doe",

"given": ["John"],

"prefix": ["Mr"]

}],

"telecom": [

{

"system": "phone",

"value": "07123456789"

},

{

"system": "email",

"value": "john.smith@example.com"

}

],

"gender": "male",

"birthDate": "1990-01-02",

"address": [{

"line": ["1 Main Street", "The Place"],

"city": "London",

"postalCode": "CB11BC"

}]

}

Example response

Status: 200 OK

Body: Empty

Failure

Example request

{

"resourceType": "Patient",

"identifier": [{

"extension": [{

"url": "https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-NHSNumberVerificationStatus-1",

"valueCodeableConcept": {

"coding": [{

"system": "https://fhir.hl7.org.uk/STU3/CodeSystem/CareConnect-NHSNumberVerificationStatus-1",

"code": "02"

}]

}

}],

"system": "https://fhir.nhs.uk/Id/nhs-number",

"value": "9999999999"

}],

"name": [{

"family": "Doe",

"given": ["John"],

"prefix": ["Mr"]

}],

"telecom": [

{

"system": "phone",

"value": "07123456789"

},

{

"system": "email",

"value": "john.smith@example.com"

}

],

"gender": "male",

"birthDate": "1990-01-02",

"address": [{

"line": ["1 Main Street", "The Place"],

"city": "London",

"postalCode": "CB11BC"

}]

}

Example response

{

"resourceType": "OperationOutcome",

"id": "5b392b1e-350b-4793-88b6-53b3d4df5cab",

"issue": [

{

"severity": "error",

"code": "invalid",

"diagnostics": "NHS number identifier is not verified"

}

]

}