Customer: Examples

Create a new Patient

See also: FHIR interaction: create

  1. Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:

    1. Your client ID

    2. Your client secret

    3. The URL for your endpoint on the sandbox environment

      1. The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com

  2. Generate an access token by following the OAuth 2.0 Client credentials walkthrough

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

  3. Create the new Patient resource by POST-ing the Patient resource to the Patient type service on your own endpoint (replacing the values with your own as required)

Request

curl -X POST --header "Accept: application/fhir+json" --header "Content-Type: application/fhir+json" --header "Authorization: Bearer abcdef" "https://acme.fhir-api.sandbox.patientsknowbest.com/fhir/Patient" --data "{ \"resourceType\": \"Patient\", \"name\": [ { \"family\": \"Bloggs\", \"given\": [ \"Joe\" ] } ] }"

Response

Success

A successful request will respond with the resource that was created, along with any server-assigned identification. You can see in this example that a resource ID of f7fffd5c-122f-4b15-bdb5-c87b9dc1850a has been assigned to the newly created resource.

{ "name":[{"given":["Joe"],"family":"Bloggs"}], "id":"f7fffd5c-122f-4b15-bdb5-c87b9dc1850a", "resourceType":"Patient", "meta":{ "lastUpdated":"2022-07-28T11:46:13.182779Z", "versionId":"6", "extension":[{"url":"ex:createdAt","valueInstant":"2022-07-28T11:46:13.182779Z"}] } }

Error

Where possible, a helpful OperationOutcome will be returned.

Search for all Appointments

See also: FHIR interaction: search

  1. Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:

    1. Your client ID

    2. Your client secret

    3. The URL for your endpoint on the sandbox environment

      1. The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com

  2. Generate an access token by following the OAuth 2.0 Client credentials walkthrough

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

  3. Search for all Appointment resources by executing the following query

Request

curl -X GET --header "Accept: application/fhir+json" --header "Content-Type: application/fhir+json" --header "Authorization: Bearer abcdef" "https://acme.fhir-api.sandbox.patientsknowbest.com/fhir/Appointment"

Response

The server will return a searchset Bundle containing the results of your search. For example, this shows a single Appointment.

Create a new Appointment

See also: FHIR interaction: create

  1. Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:

    1. Your client ID

    2. Your client secret

    3. The URL for your endpoint on the sandbox environment

      1. The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com

  2. Make sure you know the following pieces of information, which will depend on the data you have sent to PKB:

    1. The id of the Patient for whom the Appointment is scheduled

      1. The example below assumes the relevant patient is: Patient/f7fffd5c-122f-4b15-bdb5-c87b9dc1850a

  3. Generate an access token by following the OAuth 2.0 Client credentials walkthrough

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

  4. Create the new Appointment resource by POST-ing the Appointment resource to the Appointment type service on your own endpoint (replacing the values with your own as required)

Request

Response

Success

A successful request will respond with the resource that was created, along with any server-assigned identification. You can see in this example that a resource ID of f4efe66d-4cea-4199-9182-9d2113dd3108 has been assigned to the newly created resource.

Error

Where possible, a helpful OperationOutcome will be returned.

Read a specific Appointment

See also: FHIR interaction: read

  1. Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:

    1. Your client ID

    2. Your client secret

    3. The URL for your endpoint on the sandbox environment

      1. The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com

  2. Make sure you know the following pieces of information, which will depend on the data you have sent to PKB:

    1. The id of the Appointment that you wish to read

      1. The example below assumes the relevant appointment is: Appointment/f4efe66d-4cea-4199-9182-9d2113dd3108

  3. Generate an access token by following the OAuth 2.0 Client credentials walkthrough

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

  4. Read the Appointment by executing the following query.

Request

Response

Success

A successful request will respond with the resource that has the corresponding ID.

Error

Where possible, a helpful OperationOutcome will be returned.

Update a specific Appointment

See also: FHIR interaction: update

  1. Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:

    1. Your client ID

    2. Your client secret

    3. The URL for your endpoint on the sandbox environment

      1. The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com

  2. Make sure you know the following pieces of information, which will depend on the data you have sent to PKB:

    1. The id of the Appointment you wish to update

      1. The example below assumes the relevant appointment is: Appointment/f4efe66d-4cea-4199-9182-9d2113dd3108

  3. Generate an access token by following the OAuth 2.0 Client credentials walkthrough

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

  4. Update the existing Appointment resource by PUT-ing the Appointment resource to the Appointment instance service on your own endpoint (replacing the values with your own as required)

Request

Response

Success

A successful request will respond with the new content of the resource that was updated.

Error

Where possible, a helpful OperationOutcome will be returned.

Delete a specific Appointment

See also: FHIR interaction: delete

  1. Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:

    1. Your client ID

    2. Your client secret

    3. The URL for your endpoint on the sandbox environment

      1. The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com

  2. Make sure you know the following pieces of information, which will depend on the data you have sent to PKB:

    1. The id of the Appointment that you wish to delete

      1. The example below assumes the relevant appointment is: Appointment/f4efe66d-4cea-4199-9182-9d2113dd3108

  3. Generate an access token by following the OAuth 2.0 Client credentials walkthrough

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

  4. Delete the Appointment by executing the following query.

Request

Response

Success

A successful request will respond with the resource that has been deleted.

Error

Where possible, a helpful OperationOutcome will be returned.