Read about OpenEMR's Response to the COVID-19 Pandemic at https://www.open-emr.org/covid19/

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