API not updating appointment status to "CONFIRMED"

This forum is for programmers who have questions about the source code.
Post Reply
parik04
Posts: 8
Joined: Fri Feb 28, 2020 6:24 am

API not updating appointment status to "CONFIRMED"

Post by parik04 »

Hi,

I am trying to change the appointment status to "CONFIRMED" but instead it is changing to "EMAIL CONFIRMATION".

Here is the code...

<?php
$getCode = file_get_contents("php://input");

$json = json_decode($getCode, true);

$appointment_id = $json['appointment_id'];

$curl = curl_init();
curl_setopt_array($curl,
array(
CURLOPT_URL => "https://api.opendental.com/fhir/appoint ... intment_id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: FHIRAPIKey=",
"Accept: application/json"
),
)
);

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
$getPatientID = 'ERROR';
$array_temp = array('code'=>202);
} else {
$postdata = str_replace("needsaction","accepted",$response);

$curlData = curl_init();

curl_setopt_array($curlData, array(
CURLOPT_URL => "https://api.opendental.com/fhir/appoint ... intment_id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => $postdata,
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Authorization: FHIRAPIKey=",
"Content-Type: application/json"
),
));

$getResp = curl_exec($curlData);
$errData = curl_error($curlData);

curl_close($curlData);

if ($errData) {
$array_temp = array('code'=>202);
} else {
$array_temp = array('code'=>200);
}
}
echo json_encode($array_temp);
?>
PatrickC
Posts: 56
Joined: Thu Jun 06, 2019 11:37 am

Re: API not updating appointment status to "CONFIRMED"

Post by PatrickC »

If you go to Setup then Definitions in Opendental, you will be able to customize Appointment Confirmations by selecting Appt Confirmed in the column on the left. Here you will be able to add, or edit, an appointment confirmation. Here you can add a new Confirmation definition, or edit an existing by double clicking on it.

https://opendental.com/manual/confirmationstatus.html

In the "Edit Definition" window, after you have clicked add, or started editing an existing confirmation by double clicking, you will want to make sure the "Exclude when confirming" box is unchecked.

After editing/creating the definition for the confirmation, go to eServices in the main menu and select eConfirmation from the dropdown. On the left side, under the "eConfirmation Settings - Affects all Clinics" heading, click the dropdown next to "Accepted" and select the confirmation you just created/edited. Click ok and try running your fhir request again.
Patrick Carlson
Open Dental Software
http://www.opendental.com
parik04
Posts: 8
Joined: Fri Feb 28, 2020 6:24 am

Re: API not updating appointment status to "CONFIRMED"

Post by parik04 »

Hello Patrick,

I followed the steps you outlined, but I don't have eConfirmations activated. Do I need to activated eConfirmation in order to use the FHIR API to confirm appointments?

Also how do I upload screen shots on this forum?

Thank you,
Dr. Chokshi
PatrickC
Posts: 56
Joined: Thu Jun 06, 2019 11:37 am

Re: API not updating appointment status to "CONFIRMED"

Post by PatrickC »

eConfirmations will not need to be active for fhir to access the data it needs. It will pull values it needs from the db which are set by the dropdowns in the econfirmations settings.

To post a screenshot in the developers forum you'll need to host the screenshot somewhere that's accessible to the web. You can utilize image sharing sites like imgur, but be sure that it doesn't contain sensitive data. Place the link to the image inside img tags.

Code: Select all

[img]LinkToImageHere[/img]
Patrick Carlson
Open Dental Software
http://www.opendental.com
parik04
Posts: 8
Joined: Fri Feb 28, 2020 6:24 am

Re: API not updating appointment status to "CONFIRMED"

Post by parik04 »

The eConfirmation setting are greyed out. I don't have a way to click on the dropdown.

[img]C:\Users\choks\Pictures\Capture2[/img]
PatrickC
Posts: 56
Joined: Thu Jun 06, 2019 11:37 am

Re: API not updating appointment status to "CONFIRMED"

Post by PatrickC »

Would you be able to upload that image to an image sharing site, like imgur.com, then use the link they provide for your image between the img tags? We would like to see screenshot of your Definitions window with "Appt Confirmed" selected on the left hand side as well.
Patrick Carlson
Open Dental Software
http://www.opendental.com
parik04
Posts: 8
Joined: Fri Feb 28, 2020 6:24 am

Re: API not updating appointment status to "CONFIRMED"

Post by parik04 »

Hello,

The image is posted on imgur. Here is the link: https://imgur.com/5wk6mKt

Thank you,
Dr. Chokshi
User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: API not updating appointment status to "CONFIRMED"

Post by cmcgehee »

Dr. Chokshi,

You will need to log in to Open Dental with a user that has the 'eServices Setup' permission and open this window. Then you'll be able to change the Accepted setting from 'Emailed Confirmation' to something else.
Chris McGehee
Open Dental Software
http://www.opendental.com
parik04
Posts: 8
Joined: Fri Feb 28, 2020 6:24 am

Re: API not updating appointment status to "CONFIRMED"

Post by parik04 »

Okay, I will call Open Dental. I am logging into Open Dental as Admin.
parik04
Posts: 8
Joined: Fri Feb 28, 2020 6:24 am

Re: API not updating appointment status to "CONFIRMED"

Post by parik04 »

Thank you for your help. I was able to resolve the issue. Be safe and healthy!!!
Post Reply