Search code examples
restiismantis

Error using mantisbt REST API


I'm using Mantis 2.11.1 on a Windows Server with IIS 8.5 and php Version 7.0.21. I have enabled the REST API ($g_webservice_rest_enabled = ON;), created an api-token and tested the API using Postman.

For the call http://srvmantis.polymania.com/mantisbt/api/rest/Issues with the header Authorization:myAPIKey I get '404 - File or directory not found' as result.


Solution

  • I had the same problem and I've solved it this way: first install/enable URL Rewrite in IIS if you don't already have it then put this in the web.config of Mantis in the system.webServer section:

    <rewrite>
        <rules>
          <rule name="redirect to api" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            </conditions>
            <action type="Rewrite" url="api/rest/index.php/{R:1}" />
          </rule>
        </rules>
      </rewrite>

    hope this helps

    bye Cristian