API Query timeout

For requests or help with our API
Post Reply
beacondental
Posts: 113
Joined: Wed Mar 15, 2023 8:43 am

API Query timeout

Post by beacondental » Tue May 30, 2023 3:50 am

Hello API Team, We are trying to run API queries, but they are timing out after 60 seconds. Is there a way to change this as when we run the query in Open Dental, it works fine.

SLeon
Posts: 558
Joined: Mon Mar 01, 2021 10:00 am

Re: API Query timeout

Post by SLeon » Tue May 30, 2023 8:07 am

Good morning,

Which Queries method are you trying to use: Queries POST or Queries PUT ShortQuery?

Is the query you are running via the API and in Open Dental identical and to the same database?

How long does the query take to execute in Open Dental?

Is the dental office using Middle Tier with a lower timeout threshold, or does your application apply a second timeout constraint?

Have you run this specific query before via the API without issue?

Do you experience this issue with all queries you attempt to run, or just some of them?

Are you able to make other (non-query) API calls during this time period and, are you certain the dental office's database/server is available during the time you are making your request(s)?

beacondental
Posts: 113
Joined: Wed Mar 15, 2023 8:43 am

Re: API Query timeout

Post by beacondental » Wed May 31, 2023 4:53 am

Dear OpenDental Team,

1) Which Queries method are you trying to use: Queries POST or Queries PUT ShortQuery?
-> We are using the PUT ShortQuery method API

2) Is the query you are running via the API and in Open Dental identical to the same database?
-> Yes

3) How long does the query take to execute in Open Dental?
-> It takes around 120 seconds

4) Have you run this specific query before via the API without issue?
-> NO, we are trying the one query first time.

5) Do you experience this issue with all queries you attempt to run or just some of them?
-> Other queries are running fine, but the one we are facing time issue is large and complex, and in OpenDental it takes around 2 minutes to give the result

6) Are you able to make other (non-query) API calls during this time period and, are you certain the dental office's database/server is available during the time you are making your request(s)?
-> Yes we can able to make API call during this time and we have verified that the database server is running fine during a time when we make a request(s).

Please find the attachment for your reference.
Attachments
MicrosoftTeams-image.png
MicrosoftTeams-image.png (90.4 KiB) Viewed 8772 times

SLeon
Posts: 558
Joined: Mon Mar 01, 2021 10:00 am

Re: API Query timeout

Post by SLeon » Wed May 31, 2023 9:58 am

Good morning,

The Remote mode of the Open Dental API has a timeout of 60 seconds. This protects both the API and dental offices in several ways.

You can either:

1. Modify your query to execute in the necessary time. You can break the query into a few smaller ones and compile the information afterwards. Another option is to consider table indices or the overall logic behind your query and see if improvements can be made. With your query having over 1700 lines, you might prefer this option.

2. Use the Local or Service modes of the API instead. These operate at the dental office and do not have a timeout. A short guide on the API Service can be found here.

beacondental
Posts: 113
Joined: Wed Mar 15, 2023 8:43 am

Re: API Query timeout

Post by beacondental » Tue Jun 13, 2023 7:30 am

We have tried both ways for query that has 1800 lines of code and it gets timeout. Is it possible to request to do 120 seconds timeout on your end? This will give ample time for slightly complex queries.

SLeon
Posts: 558
Joined: Mon Mar 01, 2021 10:00 am

Re: API Query timeout

Post by SLeon » Tue Jun 13, 2023 7:56 am

beacondental wrote:
Tue Jun 13, 2023 7:30 am
We have tried both ways for query that has 1800 lines of code and it gets timeout.
Are you saying that you tried the Local or Service mode of the API and got a timeout error? These run at the dental office level, not our API Servers, and therefore are not limited by the same timeout.

beacondental
Posts: 113
Joined: Wed Mar 15, 2023 8:43 am

Re: API Query timeout

Post by beacondental » Tue Jun 13, 2023 8:03 am

When we run a sample run on the local work stations, a 1800 line query takes about 2 minutes and 10 seconds. And even when we split the query or split the clinic to run only one clinic, it still does the same time.

SLeon
Posts: 558
Joined: Mon Mar 01, 2021 10:00 am

Re: API Query timeout

Post by SLeon » Tue Jun 13, 2023 8:27 am

It is not clear to me if by, "...run a sample run on the local work stations" you are talking about the User Query window within Open Dental OR the Local mode of the API. It sounds like you are doing #1 and it is taking over two minutes. Have you tried #2 (either the Service or Local mode of the API)?

We will not increase the timeout of the API Servers, but this only impacts Remote API requests. The Local and Service mode of the API does not have this constraint.

I also strongly recommend re-examining your query. Breaking it into two or three queries will solve this problem. Reducing its scope (beyond clinic) would also help, such as with a date range, etc.

Post Reply