danielmarschall / oidplus

OIDplus 2.0 - An OpenSource online Registration Authority for OIDs and other Object Types
https://www.oidplus.com
Apache License 2.0
10 stars 6 forks source link

Replace AJAX with REST? #43

Open danielmarschall opened 5 months ago

danielmarschall commented 5 months ago

I was wondering, is it possible (or should we) replace all AJAX request with REST requests? Can jQuery easily access REST instead of AJAX?

If every AJAX call would be changed to REST and these REST commands are documented, then this would mean that the whole OIDplus system could be automatized? (This is also already possible using "Automated AJAX Requests", however this solution is pretty lame because it is 0% documented, and it's just "look at the code and figure out which parameters to send")

danielmarschall commented 5 months ago

It seems to work: https://stackoverflow.com/questions/2153917/how-to-send-a-put-delete-request-in-jquery

However, would it be really good to switch completely to REST? The problem is that we want very high compatibility with all web servers. But with Apache2 you must make sure that .htaccess is correctly configured to all REST call. For SQL Server you need to allow verbs "DELETE", "PUT", etc. For nginx you probably also need to so SOMETHING. So, OIDplus might NOT work "out of the box". But running "out of the box" is very very important for us.

wehowski commented 5 months ago

Hello Daniel,

you must make sure that .htaccess is correctly configured to all REST call.

For instances without mod_rewrite you can build/parse the REQUEST_QUERY for routes like /index.php/api/rest-path/... by putting the index.php in the API base path.

danielmarschall commented 5 months ago

For instances without mod_rewrite you can build/parse the REQUEST_QUERY for routes like /index.php/api/rest-path/... by putting the index.php in the API base path.

Thanks for this hint! Does /index.php/xxx really always work, with every Apache configuration? What about nginx? I will also try if it works on Microsoft IIS when I am at my other computer.

danielmarschall commented 5 months ago

Update: /index.php/xxx works with Microsoft IIS. Remaining question is if nginx does also accept this.