Help with API V5.0.2


(P.A.I) #1

I need to authenticate patients, make an appointment and other things, I saw that in the version 5.0.2 there are some routes and some rest controllers. I was wondering if there is any guide or documentation that says anything about this, how I can use it or modify, thanks.

(Stephen Waite) #2

@brady.miller gave us some example usage for internal use, openemr/InternalApiTest.php at master · openemr/openemr · GitHub

for external use:

(P.A.I) #3

Ok, thanks a lot, can you help me with something more?
I was looking here

And there isn’t a route if you wanna search for avaliable appointments in the calendar by a doctor or date just like the calendar info, Is there any functionality or I have to create it?

Thanks for your answer

(Stephen Waite) #4

ok, try adding your function to this class and maybe share your results with the community

(Jerry P) #5

All the rest controllers and service are located in openemr/src i.e src/RestControllers
Routes are defined in in root directory.

These are the places you want to do your modifications.

Help implementing API functionality
(P.A.I) #6

Ok, thanks. I have one more question:

When I get the auth token using the “/apis/api/auth” route, I have to send the site id in the “scope” property. Each site has a sqlconfig file inside, so I guess that some file has the logic which manages the database connection using the token.
I have to create some additional methods for some features and I would like to know how I can be sure that the connection is fine.

Thanks a lot.

(Ralf Lukner MD PhD) #7

I’m trying to learn more about this REST api. When I type the following command (with instead of localhost), the following curl command issued at the command line of the AWS EC2 instance, I do not get a response at the command line … it just seems to “hang” until I abort it with ctrl-c

curl -X POST -H 'Content-Type: application/json' 'https://localhost:8300/apis/api/auth' \
-d '{
    "username": "ServiceUser",
    "password": "password",
    "scope":"site id"

(P.A.I) #8

Did you enable the REST API?

Enable this API service in OpenEMR menu: Administration->Globals->Connectors->“Enable OpenEMR REST API”


(Ralf Lukner MD PhD) #9

Yes, I certainly did.

Do I also need to enable the FHIR service? Also, is the FHIR base address relevant to this?

(Brady Miller) #10

hi @Ralf_Lukner ,
The FHIR service/settings are unrelated to the api. For your address, ensure you didn’t use port 8300 in the address. ie. should be ''

(Ralf Lukner MD PhD) #11

Thank you! That was the problem with it hanging. I still have some ssl certificate errors … something I need to correct and then retry.