Strange Response from Create Appointment in Standard API

When creating a new Appointment for a Patient using the Standard API I am getting a 500 error with a strange HTML response:

<h2>    
<font color='red'>Query Error</font></h2><p>    <font color='red'>ERROR:</font> insert failed: INSERT INTO openemr_postcalendar_events SET uuid=? pc_pid=?,
    pc_catid=?, pc_title=?, pc_duration=?, pc_hometext=?, pc_eventDate=?, pc_apptstatus=?, pc_startTime=?, pc_endTime=?,
    pc_facility=?, pc_billing_location=?, pc_informant=1, pc_eventstatus=1, pc_sharing=1, pc_aid=?
</p><p>Error: <font color='red'>You have an error in your SQL syntax; check the manual that corresponds to your MariaDB
        server version for the right syntax to use near 'pc_pid='1', pc_catid='5', pc_title='Office Visit',
        pc_duration='9...' at line 1</font></p><br />/var/www/localhost/htdocs/openemr/src/Services/AppointmentService.php at 297:sqlInsert<br />/var/www/localhost/htdocs/openemr/src/RestControllers/AppointmentRestController.php at 78:insert(1,Array)<br />/var/www/localhost/htdocs/openemr/_rest_routes.inc.php at 5161:post(1,Array)<br />/var/www/localhost/htdocs/openemr/src/Common/Http/HttpRestRouteHandler.php at 91:{closure}

If anyone has any suggestions on how to get around this please let me know.

1 Like

Hi Tanner Quigley
Its return php query error so can you check your Query is correct or not
Thanks
Param
help@capminds.com

I’m having a similar issue. This is the request w/o the auth header…

curl -X 'POST' \
  'https://openemr.intely.io/apis/default/api/patient/3/appointment' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "pc_catid": "5",
    "pc_title": "Office Visit",
    "pc_duration": "900",
    "pc_hometext": "Test",
    "pc_apptstatus": "-",
    "pc_eventDate": "2023-02-21",
    "pc_startTime": "09:30",
    "pc_facility": "3",
    "pc_billing_location": "3",
    "pc_aid": "5"
    }''

Any help would be appreciated. @Param_CapMinds - not sure what the PHP error would be? Seems like the values are not getting passed through properly from the request body but request body follows documentation. @openemr

openemr_postcalendar_events table don’t have uuid column may be that was the error.

openemr_postcalendar_events table does have a uuid column. It was added in patch 2 here:

I would suggest checking that your database is up to date (using sql_upgrade.php). If your database is missing a uuid column for the table then your database is not running the latest patch and the code is out of sync.

ok we will check…thanks for information

Looking at the source it looks like there is a comma missing after the question mark on the uuid param in the insert function on line 277 of AppointmentService.php.

I have created a GitHub issue: POST /api/patient/{pid}/appointment standard api endpoint throws an error · Issue #6238 · openemr/openemr · GitHub