The Britain Posted June 6, 2018 Posted June 6, 2018 Hey I don't mean to blow up your forums with a few threads, and I'm trying to genuinely solve these problems before I come here, but this one has be stumped a bit. I'm creating a rest api for the site to use, and I can't seem to get the /core/hello to work let alone anything else. I've setup the key as such. I then used the example snippet, modified of course. $communityUrl = 'http://test.accursedfarms.com/'; $apiKey = '00a75c3993dc5a20fade6f9150f14645'; $endpoint = '/core/hello'; $curl = curl_init( $communityUrl . 'api' . $endpoint . '?key=' . $apiKey ); curl_setopt_array( $curl, array( CURLOPT_RETURNTRANSFER => TRUE, ) ); $response = curl_exec( $curl ); echo $communityUrl . 'api' . $endpoint . '?key=' . $apiKey; echo "<br />"; echo $response; And I keep getting this generic failure. This is baffling me a bit, as I have no IP restrictions turned on, mod_rewrite is working as expected, and I added the suggested mod_rewrite to my /root/api folder from the documentation. This is my root level mod_rewrite .htaccess. I tried removing this .htaccess all together as it didn't seem needed, but it didn't help. The documentation says this means invalid characters, but everything seems to be setup correctly. <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule \.(jpeg|jpg|gif|png)$ /public/404.php [NC,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> And this is my /root/api level mod_rewrite .htaccess. <IfModule mod_setenvif.c> SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 </IfModule> <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase /api/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] </IfModule> Any help or suggestions are appreciated. Maybe it has to do with pages and the fact that the root domain lands on a page instead of the forums? I have no idea what could be causing this. This is the closest thing I can find to an answer, and it doesn't work. https://webflake.sx/topic/23248-rest-api-getting-3s2903-invalid_app/
The Britain Posted June 7, 2018 Author Posted June 7, 2018 I've checked all of the folder perms and mod_rewrite is working as intended. I can not figure out why this is not working. That was the only thread having the same issue, and a moderator locked it for no apparent reason.
bfarber Posted June 7, 2018 Posted June 7, 2018 Your mod_rewrite isn't working, so you have to use /index.php?/ in your URL. http://test.accursedfarms.com/api/index.php?/core/hello&key=00a75c3993dc5a20fade6f9150f14645
The Britain Posted June 7, 2018 Author Posted June 7, 2018 3 minutes ago, bfarber said: Your mod_rewrite isn't working, so you have to use /index.php?/ in your URL. http://test.accursedfarms.com/api/index.php?/core/hello&key=00a75c3993dc5a20fade6f9150f14645 I'll be damned. Thank you. Not to press your generosity, but do my .htaccess files look right? I have no idea how to proceed to get the mod_rewrite working.
bfarber Posted June 7, 2018 Posted June 7, 2018 On the surface, yes, however (1) the server config needs to have AllowOverrides enabled, and (2) of course the mod_rewrite module needs to be enabled. I would contact your host about that to see why the htaccess files to enable mod_rewrite aren't working.
The Britain Posted June 7, 2018 Author Posted June 7, 2018 Just now, bfarber said: On the surface, yes, however (1) the server config needs to have AllowOverrides enabled, and (2) of course the mod_rewrite module needs to be enabled. I would contact your host about that to see why the htaccess files to enable mod_rewrite aren't working. Ah, I just assumed mod_rewrite was working because nothing was throwing an error. I guess I shouldn't just assume things. Thank you again for your help!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.