southbeach
Programmer
After so many years of writing mostly procedural PHP code, I am at a point where I must step out of my comfort zone and write a RESFUL API.
Not a big deal, really, except that for the life of me, the endpoints are kicking my rear-end.
My problem:
if I define my URI to be api.sitename.com which is just a vhost that points to sitename.com/api
within ~/api directory I created .htaccess file that looks as follows
my index.php script I look for endpoints by exploding the URI and the returned elements are validated to
1. identify class
2. identify method
so, given this scenario, the URI api.sitename.com/rfq/get should call $rfq->get() but instead I am getting error 404
The above .htaccess file is in ~/api directory or root directory for api.sitename.com. Do I need to create subdirectories for every possible endpoint and place the .htaccess file in each of these endpoints? If that is the case, this is crazy ...
I am frustrated, this should not be so confusing or I should not be so clueless.
Thank you all for you assistance!
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
Not a big deal, really, except that for the life of me, the endpoints are kicking my rear-end.
My problem:
if I define my URI to be api.sitename.com which is just a vhost that points to sitename.com/api
within ~/api directory I created .htaccess file that looks as follows
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)$ index.php?request=$1 [QSA,NC,L]
</IfModule>
my index.php script I look for endpoints by exploding the URI and the returned elements are validated to
1. identify class
2. identify method
so, given this scenario, the URI api.sitename.com/rfq/get should call $rfq->get() but instead I am getting error 404
The above .htaccess file is in ~/api directory or root directory for api.sitename.com. Do I need to create subdirectories for every possible endpoint and place the .htaccess file in each of these endpoints? If that is the case, this is crazy ...
I am frustrated, this should not be so confusing or I should not be so clueless.
Thank you all for you assistance!
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.