ShortQuery help

For requests or help with our API
Post Reply
darcockerell
Posts: 11
Joined: Mon Jan 31, 2022 8:51 am

ShortQuery help

Post by darcockerell » Mon Jan 31, 2022 8:54 am

We are having trouble testing the ShortQueries.

Our API Patient GET requests are working

Our Short Query - PUT is not working. We are using a sample query provided in this page https://www.opendental.com/site/apiqueries.html and it gives the 400 BadRequest error

We are doing this for PUT URL: https://api.opendental.com/api/v1/queries/ShortQuery
We are doing this for the BODY:
{
"SqlCommand": "SELECT count(*) FROM Patients"
}

It does not seem to be a user permissions issue because our GET requests are working. There was another post where ShortQueries weren't working because of an outdated version - our OD version is 21.3 so we don't think that is the issue either. Any advice on what to check?

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

Re: ShortQuery help

Post by SLeon » Mon Jan 31, 2022 9:59 am

What is the specific error message you are getting with the 400 BadRequest error? This will describe a number of SQL-related issues with the query you are trying to run.

For example, your SQL command should be "SELECT * FROM patient" (not plural "patients"). You are likely getting the an error message that states, "An SQL error occurred: Table 'patients' doesn't exist."

darcockerell
Posts: 11
Joined: Mon Jan 31, 2022 8:51 am

Re: ShortQuery help

Post by darcockerell » Tue Feb 01, 2022 6:28 am

Thanks SLeon, the 400 BadRequest error doesn't give any additional information.

Strangely, we ended up just uninstalling OD and reinstalling and now the Short Queries are working fine.

So, I guess if anyone else is just getting started and having trouble with a 400 error - maybe try uninstalling and reinstalling :D

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

Re: ShortQuery help

Post by SLeon » Tue Feb 01, 2022 8:17 am

I am glad you've got it working. That leads me to believe that there might have been an issue with the dental office's eConnector. When that is the case, it returns a 400 error and a "An error has occurred on the server" message.

To others that may encounter this issue, I would first make sure the eConnector is up to date. Restarting the eConnector service should resolve any issues at that point.

Post Reply