Cannot get API to work

hi @vandijk, for the internal api test script, InternalApiTest.php, you have to edit it and remove the exit() function located at the top for security purposes.

Hi, i also got same issue.

Problem was .htacces was overridden by Apache default settings. So the rewrite in file /var/www/html/yoursite/apis/.htaccess do not work.
I solved the problem by adding this to the /etc/apache2/sites-available/yoursite.conf:
<Directory /var/www/html/yoursite>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

This works for my test-site. Don’t use this blindly for a production site!!!

I don’t know why we are the only ones having this problem…

Yes but I managed with making custom API. I have made custom API with that admin can send dynamically message to any patient.

Thank you

@vandijk,

I am having same problem not able to do authenticate using rest api , can please share me your full flow what steps you had followed to resolve API issue. Below error is showing while doing authentication 404 Not Found or Bad Request

Thanks,
Nilesh

Hi All,

Here is final solution for API issue, when your API is not working or showing HTTP 404 error you means your .htaccess is not working just go to apache config file check AllowOverride option and change the AllowOverride None to AllowOverride All.

Now try again API url you should receive the internal server error means the our .htaccess is working but we did not enabled the apache mod_rewrite. use below command to enable mod_rewrite a2enmod rewrite then restart the server.

Note: If you install the separate apache server then and then only you will get this issue but you taken apache2 from OpenEMR site it will not going issue you because they already made that changes into the apache2 server.

Thanks,
Nilesh

1 Like

Hi @vandijk,

Is there any REST API document for v 5.0.2 that you referred to? I am trying to use opemEMR REST APIs too but not able to get hold of any API documentation. Any information on this would help.

Thanks,
Annapoorna

Here is the link for the API docs for version 5.0.2

Hi @Nilesh_Hake @brady.miller
I followed every step but still it is not working.


So i have installed openemr on a public ubuntu machine and the UI is working, I have a administrator set up just the authorization and apis is giving me a 404 error. I have changed openemr.conf in apache2/sites-available as per your comments to AllowOverride All but then too it doesn’t work

hi @Manan17 , are you using SSL(https)? It’s required based on the API README.

Hi @stephenwaite I did to it using ssl certificate. Now I am getting an error that my IP is refusing to connect after login

Hi @stephenwaite @brady.miller I have fixed this. I also have managed to get the SSL.
Now when I use https://182.xx.xx.xx/openemr it gives me the login page and I can get through it. Like shown here:

But when I try to register an API client through postman I get a 404 error.

Please help. This is urgent!!!
Also, I have tried keeping the URL in admin>global>connectors as https://localhost as well. Doesn’t work

1 Like