Jump to content

Friendly URL issue on REST API endpoint


Jock3r
 Share

Go to solution Solved by Jock3r,

Recommended Posts

  • Solution
Posted (edited)

Hello there,

I am currently experiencing an issue setting up the REST API on a test forum. The issue is that when I got to AdminCP > REST & OAuth and do what it asks me for I keep getting "The API endpoint is not giving the expected response. Check you followed the instructions correctly. The URL being tested is: https://www.testforum.example/api/core/hello"

I have uploaded the .htaccess file it asked me to to the given directory(/api), I also have Friendly URLs enabled, I do not have index.php anywhere on the forum, however on the /api endpoint the index.php is needed inorder to access the urls. When I first visit www.testforum.example/api I get the error I should have regarding the api key not being there, however when I add /api/core/hello I get the 404 IPS error page, but when I do /api/index.php?/core/hello I get the noapi key invalid error again. Moreover, /api/?core/hello looks to be working fine but I still cannot get to pass that error page to generate a key.

I am currently using the default nginx config provided here 

PHP Version: 7.4

Mysql Version: MariaDB 1.1.48

and I have also used the PHP-FPM config provided on the thread as well.

Does anyone have any idea what could the issue be?

 

EDIT: I have solved the issue, looks like I did not setup the nginx config properly for the api endpoint.

For anyone ever coming up with the same issue you may want to add this or anything similar to your nginx config:

    # IPS API
    location /api/ {
        try_files $uri $uri/ @api;
    }

    # IPS API LOCATION
    location @api {
        rewrite ^ /api/index.php?$args last;
    }

 

Edited by Jock3r
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...