FHIR API server errors

This forum is for programmers who have questions about the source code.
Post Reply
bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

FHIR API server errors

Post by bravegag »

Hi Chris,

I started getting this error today and for any request e.g.

Code: Select all

FHIR GET request https://api.opendental.com/fhir/v2/location?organization=organization/0
I then get:

Code: Select all

{"issue":[{"severity":"error","code":"exception","details":{"text":"The server has encountered an error."}}]}
Any ideas what's happening? I made sure to get my sandbox up to date; as of now I have 19.2.18.0.

TIA,
Best regards,
Giovanni
User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: FHIR API server errors

Post by cmcgehee »

Giovanni, it looks like your eConnector is not running. Once you turn it on, this error should go away.
Chris McGehee
Open Dental Software
http://www.opendental.com
bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

Re: FHIR API server errors

Post by bravegag »

Hi Chris,
cmcgehee wrote:Giovanni, it looks like your eConnector is not running. Once you turn it on, this error should go away.
Thanks! I checked and the eConnector showed always started/running ... after I took the latest update then it works again, so all good.

Thank you and best regards,
Giovanni
bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

Re: FHIR API server errors

Post by bravegag »

Hi Chris,

I still get these spurious server errors, I checked and my sandbox installation is up to date and the eConnector service running (see below).
Image

Why are these sporadic errors happening?

Many TIA,
Best regards,
Giovanni
User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: FHIR API server errors

Post by cmcgehee »

In the location where the eConnector is installed, there is a folder named "Logger". There should be some files in there that help show what is going on, particularly the ProxyRemoteImmortal, EConnectorService, and LogWeb folders.
Chris McGehee
Open Dental Software
http://www.opendental.com
bravegag
Posts: 49
Joined: Fri May 24, 2019 3:37 pm

Re: FHIR API server errors

Post by bravegag »

Hi Chris,

I do again have the issue:

The ProxyRemoteInmortal in folder today shows:

Code: Select all

09/06/19 20:35:58:866	Thread loop failed: Quit event raised
The EConnectorService in folder today shows:

Code: Select all

09/06/19 20:34:52:603	Setting the no-sleep override.
09/06/19 20:34:52:603	OpenDentalEConnector Service is starting.
09/06/19 20:35:58:852	OpenDentalEConnector Service has stopped.
09/06/19 20:36:40:423	Setting the no-sleep override.
09/06/19 20:36:40:423	OpenDentalEConnector Service is starting.
The LogWeb in folder today shows:

Code: Select all

09/06/19 20:34:53:574	Message: eConnector Version matches Program Version.
Function Name: ListenerManagerThread : )
Is Exception: False
Application Log Level: Error
Entry Log Level: Error

Data Context:
eConnector Version: 19.2.20.0. Program Version: 19.2.20.0.

Call Stack:
1 - ListenerManagerThread : )
2 - ODThread : Run
3 - ThreadHelper : ThreadStart_Context
4 - ExecutionContext : RunInternal
5 - ExecutionContext : Run

09/06/19 20:36:40:663	Message: eConnector Version matches Program Version.
Function Name: ListenerManagerThread : )
Is Exception: False
Application Log Level: Error
Entry Log Level: Error

Data Context:
eConnector Version: 19.2.22.0. Program Version: 19.2.22.0.

Call Stack:
1 - ListenerManagerThread : )
2 - ODThread : Run
3 - ThreadHelper : ThreadStart_Context
4 - ExecutionContext : RunInternal
5 - ExecutionContext : Run
I look forward your feedback.

Best regards,
Giovanni
User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: FHIR API server errors

Post by cmcgehee »

Well, your eConnector is definitely shutting down and restarting. The eConnector logs generally don't say why it's starting or stopping, so you'll have to figure that out yourself. Maybe the computer is restarting, maybe the eConnector service does not have a startup type of automatic.
Chris McGehee
Open Dental Software
http://www.opendental.com
arm5060
Posts: 4
Joined: Tue Nov 05, 2019 12:40 am

Re: FHIR API server errors

Post by arm5060 »

Hi cmcgehee,

You are doing fantastic job by helping everyone here.
This is my first post. I am a developer and trying to integrate OpenDental with one of our Web Application.

I was trying to get list of appointments using a test PHP script by using our FHIRAPIKey of OpenDental setup.

Here is the code:

Code: Select all

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.opendental.com/fhir/appointment",
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",
"x-auth-token: FHIRAPIKey=XXXYYYZZZ",
"Accept: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
print_r(json_decode($response));
} ?>
But that always return me error as below:

Code: Select all

stdClass Object
(
    [issue] => Array
        (
            [0] => stdClass Object
                (
                    [severity] => error
                    [code] => login
                    [details] => stdClass Object
                        (
                            [text] => Developer API key required.
                        )

                )

        )

)
I have confirmed, the eConnector service is running.

OpenDental version is: 19.1.44.0

Please let me know what else i can check to troubleshoot this.

Looking forward to hearing back from you soon.


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

Re: FHIR API server errors

Post by cmcgehee »

Your PHP script is close. If you just change "x-auth-token: FHIRAPIKey=XXXYYYZZZ" to ""Authorization: FHIRAPIKey=XXXYYYZZZ", then the request should work.
Chris McGehee
Open Dental Software
http://www.opendental.com
arm5060
Posts: 4
Joined: Tue Nov 05, 2019 12:40 am

Re: FHIR API server errors

Post by arm5060 »

Hi Cmcgehe,

Thank you for your response. I just checked and tried after changing but now it's giving me error of invalid API key.
I have checked the API key is right and also the eConnector is working.

Code: Select all

stdClass Object
(
    [issue] => Array
        (
            [0] => stdClass Object
                (
                    [severity] => fatal
                    [code] => security
                    [details] => stdClass Object
                        (
                            [text] => Invalid API key(s).
                        )

                )

        )

)

Can you please share how do i troubleshoot further?

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

Re: FHIR API server errors

Post by cmcgehee »

Can you send me your full request including your API key in a private message? I can check to make sure the API key is still valid.
Chris McGehee
Open Dental Software
http://www.opendental.com
arm5060
Posts: 4
Joined: Tue Nov 05, 2019 12:40 am

Re: FHIR API server errors

Post by arm5060 »

Hi cmchegee,

Thank you.
I have sent you personal message.
Please check.

Thank you
Post Reply