API to update appointment status

This forum is for programmers who have questions about the source code.
Post Reply
arm5060
Posts: 4
Joined: Tue Nov 05, 2019 1:40 am

API to update appointment status

Post by arm5060 » Wed Feb 05, 2020 11:06 pm

Hello,

I need a small help regarding updating Appointment status to confirmed/cancelled etc using API.
I do have appointment ID.

Can any one provide me sample request to do it?

Much appreciated.

Thanks,
Arpit

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

Re: API to update appointment status

Post by cmcgehee » Thu Feb 06, 2020 8:49 am

When you GET an appointment, you will see there is a participant where the actor is a patient. One of the fields on the participant object is "status". This will be "needsaction" when the patient has not confirmed the appointment and will be "accepted" once the patient has confirmed. You can send a PUT request to change the status to accepted. Keep in mind that you have to include all other fields in your request so that don't inadvertently change a different field. Here is an example PUT request to change an appointment to confirmed:

Code: Select all

{
  "resourceType": "Appointment",
  "status": "booked",
  "priority": 1,
  "description": "CmpEx",
  "start": "2020-03-20T14:20:00",
  "end": "2020-03-20T15:00:00",
  "minutesDuration": 40,
  "participant": [{
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PART",
              "display": "Participation"
            }
          ]
        }
      ],
      "actor": {
        "reference": "patient/149",
        "display": "Hannah Abbott"
      },
      "required": "required",
      "status": "accepted"
    }, {
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PPRF",
              "display": "primary performer"
            }
          ]
        }
      ],
      "actor": {
        "reference": "practitioner/1",
        "display": "Madame Pomprey, DMD"
      },
      "required": "required",
      "status": "accepted"
    }, {
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PART",
              "display": "Participation"
            }
          ]
        }
      ],
      "actor": {
        "reference": "location/3",
        "display": "OP-3"
      },
      "required": "required",
      "status": "accepted"
    }
  ],
  "basedOn": [{
      "reference": "servicerequest/7854856268706751589",
      "display": "CmpEx"
    }
  ]
}
To indicate that a patient will not show up for their appointment, set the "status" on the Appointment resource to "noshow". This will display as a broken appointment within Open Dental. Here's an example:

Code: Select all

{
  "resourceType": "Appointment",
  "status": "noshow",
  "priority": 1,
  "description": "CmpEx",
  "start": "2020-03-20T14:20:00",
  "end": "2020-03-20T15:00:00",
  "minutesDuration": 40,
  "participant": [{
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PART",
              "display": "Participation"
            }
          ]
        }
      ],
      "actor": {
        "reference": "patient/149",
        "display": "Hannah Abbott"
      },
      "required": "required",
      "status": "accepted"
    }, {
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PPRF",
              "display": "primary performer"
            }
          ]
        }
      ],
      "actor": {
        "reference": "practitioner/1",
        "display": "Madame Pomprey, DMD"
      },
      "required": "required",
      "status": "accepted"
    }, {
      "type": [{
          "coding": [{
              "system": "http://hl7.org/fhir/participant-type",
              "code": "PART",
              "display": "Participation"
            }
          ]
        }
      ],
      "actor": {
        "reference": "location/3",
        "display": "OP-3"
      },
      "required": "required",
      "status": "accepted"
    }
  ],
  "basedOn": [{
      "reference": "servicerequest/7854856268706751589",
      "display": "CmpEx"
    }
  ]
}
Chris McGehee
Open Dental Software
http://www.opendental.com

poonam
Posts: 8
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Mon Sep 14, 2020 12:03 pm

Hi,

I am trying to cancel the appointment through API call but it gives server error.

I am using following body-code with PUT request for updating the appointment status.

Code: Select all

{
                "status": "cancelled",
                "priority": 5,
                "description": "Flo",
                "start": "2020-09-15T16:00:00",
                "end": "2020-09-15T16:45:00",
                "minutesDuration": 45,
                "participant": [
                    {
                        "type": [
                            {
                                "coding": [
                                    {
                                        "system": "http://hl7.org/fhir/participant-type",
                                        "code": "PART",
                                        "display": "Participation"
                                    }
                                ]
                            }
                        ],
                        "actor": {
                            "reference": "patient/13",
                            "display": "test"
                        },
                        "required": "required",
                        "status": "needsaction"
                    },
                    {
                        "type": [
                            {
                                "coding": [
                                    {
                                        "system": "http://hl7.org/fhir/participant-type",
                                        "code": "PPRF",
                                        "display": "primary performer"
                                    }
                                ]
                            }
                        ],
                        "actor": {
                            "reference": "practitioner/3",
                            "display": "Practitioner"
                        },
                        "required": "required",
                        "status": "accepted"
                    },
                    {
                        "type": [
                            {
                                "coding": [
                                    {
                                        "system": "http://hl7.org/fhir/participant-type",
                                        "code": "PART",
                                        "display": "Participation"
                                    }
                                ]
                            }
                        ],
                        "actor": {
                            "reference": "location/1",
                            "display": "OP-1"
                        },
                        "required": "required",
                        "status": "accepted"
                    }
                ],
                "basedOn": [
                    {
                        "reference": "servicerequest/40"
                    }
                ],
                "reasonReference": []
}

The response for the same is

Code: Select all

{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "exception",
            "details": {
                "text": "The server has encountered an error."
            }
        }
    ]
}
On the other hand, when I am trying status from the below list:
proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in | waitlist
Only booked and no-show works.

So please let me know how to change status from booked to cancelled through API?

Thanks in Advance!

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

Re: API to update appointment status

Post by cmcgehee » Mon Sep 21, 2020 10:57 am

We've committed the fix for this error. It will be available in 20.2.44 and 20.3.27. We still might have some more work to do after this because we noticed that when using the status "cancelled" it will give the appointment a status of "noshow".
Chris McGehee
Open Dental Software
http://www.opendental.com

poonam
Posts: 8
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Tue Sep 22, 2020 9:48 am

Hi Chris,

Thank you for your response and we will update the opendental once next version will be released. Also can you help me with finding free slots from multiple operatory in single API call?

For example,
https://api.opendental.com/fhir/v2/slot ... tatus=free
here, we get free slots from operatory 1 and in the same api call if we want free slots from operatory 2 and 3 as well then how to define the condition in API header.

Appreciate your help and time with this!

Sincerely,
Poonam

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

Re: API to update appointment status

Post by cmcgehee » Mon Sep 28, 2020 8:22 am

Poonam,

You should be able to use commas to include multiple schedules to get slots for multiple operatories in one request. For example:

Code: Select all

https://api.opendental.com/fhir/v2/slot?schedule=20200921L1,20200921L2,20200921L3&status=free
Chris McGehee
Open Dental Software
http://www.opendental.com

poonam
Posts: 8
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Mon Sep 28, 2020 1:04 pm

Hi Chris,
Thank you for your reply!

I tried using comma but I am getting response for only last schedule given in the parameters list.

For eg,

Code: Select all

https://api.opendental.com/fhir/v2/slot?schedule=20200921L1,20200921L2,20200921L3&status=free
For the above request I am getting response only for schedule 20200921L3.

Appreciate your time!

Sincerely,
Poonam

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

Re: API to update appointment status

Post by cmcgehee » Mon Sep 28, 2020 5:19 pm

Would you mind telling me the version of Open Dental the database is on that you are sending requests to? In 20.2.29 we fixed an issue that had to do with Slots.
Chris McGehee
Open Dental Software
http://www.opendental.com

poonam
Posts: 8
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Wed Sep 30, 2020 1:00 pm

Hi Chris,

The version of opendental that we are using is 20.2.40.0 which was last updated on 09/10/20.

Thanks and regards,
Poonam

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

Re: API to update appointment status

Post by cmcgehee » Mon Oct 05, 2020 2:00 pm

Thanks, I'll have one of our engineers look into this issue.
Chris McGehee
Open Dental Software
http://www.opendental.com

poonam
Posts: 8
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Fri Oct 16, 2020 1:36 pm

Hi Chris,

Any update on passing multiple schedule?

Thanks,

rochelle
Posts: 2
Joined: Mon Jun 01, 2020 10:29 am

Re: API to update appointment status

Post by rochelle » Mon Oct 19, 2020 11:33 am

Poonam,
I apologize for the delay in getting back to you. I have investigate this and you are correct, presently we only return the slots for 1 schedule. I will be creating a fix for this and will update this thread the moment it is live.

poonam
Posts: 8
Joined: Mon Aug 24, 2020 1:17 pm

Re: API to update appointment status

Post by poonam » Tue Oct 20, 2020 11:12 am

Thank you for your reply!

Hope to receive the update soon on this.

Thanks,
Poonam

Post Reply