Best Way to Retrieve Deleted Patients via API

For requests or help with our API
Post Reply
Ummehani
Posts: 12
Joined: Fri May 24, 2024 2:27 am

Best Way to Retrieve Deleted Patients via API

Post by Ummehani » Fri Feb 21, 2025 1:53 am

We are looking for the best way to retrieve deleted patients using Open Dental’s API. Based on our findings, Open Dental does not provide a direct API to get deleted patients, as the GET Patients API does not return records with a "Deleted" status.

However, we found that using the Queries PUT ShortQuery API, we can retrieve deleted patient records with the following query:

Code: Select all

{
    "SqlCommand": "SELECT * FROM patient WHERE PatStatus = 4"
}
Before implementing this approach, we wanted to check if there is a more recommended or standard way to retrieve deleted patient records. Is there any other API or method available for this?

Any guidance on retrieving deleted patients via API would be greatly appreciated!

justine
Posts: 267
Joined: Tue Dec 28, 2021 7:59 am

Re: Best Way to Retrieve Deleted Patients via API

Post by justine » Fri Feb 21, 2025 8:21 am

Ummehani wrote:
Fri Feb 21, 2025 1:53 am
We are looking for the best way to retrieve deleted patients using Open Dental’s API. Based on our findings, Open Dental does not provide a direct API to get deleted patients, as the GET Patients API does not return records with a "Deleted" status.

However, we found that using the Queries PUT ShortQuery API, we can retrieve deleted patient records with the following query:

Code: Select all

{
    "SqlCommand": "SELECT * FROM patient WHERE PatStatus = 4"
}
Before implementing this approach, we wanted to check if there is a more recommended or standard way to retrieve deleted patient records. Is there any other API or method available for this?

Any guidance on retrieving deleted patients via API would be greatly appreciated!
That'll work.

Ummehani
Posts: 12
Joined: Fri May 24, 2024 2:27 am

Re: Best Way to Retrieve Deleted Patients via API

Post by Ummehani » Wed Mar 12, 2025 5:01 am

Thank you for the prompt response and confirmation regarding retrieving deleted patients using the PUT ShortQuery API.

We now have another query:
We attempted to delete appointment records using the PUT ShortQuery API with the following query:

Code: Select all

{
    "SqlCommand": "DELETE FROM appointment WHERE AptNum = [AppointmentId]"
}
However, we encountered the following error:

Code: Select all

"Query command must either be read-only or execute on a temporary table."
Since there is no direct DELETE API available for patients or appointments, we would like to know:

What is the recommended approach to delete patient or appointment records using Open Dental’s API?
Is there any alternative method or workaround to perform deletions?
We would greatly appreciate any guidance on how to handle deletions through the API.

justine
Posts: 267
Joined: Tue Dec 28, 2021 7:59 am

Re: Best Way to Retrieve Deleted Patients via API

Post by justine » Wed Mar 12, 2025 8:27 am

Ummehani wrote:
Wed Mar 12, 2025 5:01 am
Thank you for the prompt response and confirmation regarding retrieving deleted patients using the PUT ShortQuery API.

We now have another query:
We attempted to delete appointment records using the PUT ShortQuery API with the following query:

Code: Select all

{
    "SqlCommand": "DELETE FROM appointment WHERE AptNum = [AppointmentId]"
}
However, we encountered the following error:

Code: Select all

"Query command must either be read-only or execute on a temporary table."
Since there is no direct DELETE API available for patients or appointments, we would like to know:

What is the recommended approach to delete patient or appointment records using Open Dental’s API?
Is there any alternative method or workaround to perform deletions?
We would greatly appreciate any guidance on how to handle deletions through the API.
Hello Ummehani,

Appointments and Patients are never deleted in Open Dental.

Thanks!

Post Reply