Customer: Examples
Create a new Patient
See also: FHIR interaction: create
Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:
Your client ID
Your client secret
The URL for your endpoint on the sandbox environment
The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com
Generate an access token by following the OAuth 2.0 Client credentials walkthrough
The example below assumes you have been granted an access token of: abcdef
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
Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:
Your client ID
Your client secret
The URL for your endpoint on the sandbox environment
The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com
Generate an access token by following the OAuth 2.0 Client credentials walkthrough
The example below assumes you have been granted an access token of: abcdef
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
Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:
Your client ID
Your client secret
The URL for your endpoint on the sandbox environment
The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com
Make sure you know the following pieces of information, which will depend on the data you have sent to PKB:
The id of the Patient for whom the Appointment is scheduled
The example below assumes the relevant patient is: Patient/f7fffd5c-122f-4b15-bdb5-c87b9dc1850a
Generate an access token by following the OAuth 2.0 Client credentials walkthrough
The example below assumes you have been granted an access token of: abcdef
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
Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:
Your client ID
Your client secret
The URL for your endpoint on the sandbox environment
The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com
Make sure you know the following pieces of information, which will depend on the data you have sent to PKB:
The id of the Appointment that you wish to read
The example below assumes the relevant appointment is: Appointment/f4efe66d-4cea-4199-9182-9d2113dd3108
Generate an access token by following the OAuth 2.0 Client credentials walkthrough
The example below assumes you have been granted an access token of: abcdef
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
Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:
Your client ID
Your client secret
The URL for your endpoint on the sandbox environment
The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com
Make sure you know the following pieces of information, which will depend on the data you have sent to PKB:
The id of the Appointment you wish to update
The example below assumes the relevant appointment is: Appointment/f4efe66d-4cea-4199-9182-9d2113dd3108
Generate an access token by following the OAuth 2.0 Client credentials walkthrough
The example below assumes you have been granted an access token of: abcdef
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
Make sure you know the following pieces of information, which will have been issued to you by the Integration Team:
Your client ID
Your client secret
The URL for your endpoint on the sandbox environment
The example below assumes you have a server host of: acme.fhir-api.sandbox.patientsknowbest.com
Make sure you know the following pieces of information, which will depend on the data you have sent to PKB:
The id of the Appointment that you wish to delete
The example below assumes the relevant appointment is: Appointment/f4efe66d-4cea-4199-9182-9d2113dd3108
Generate an access token by following the OAuth 2.0 Client credentials walkthrough
The example below assumes you have been granted an access token of: abcdef
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.