Getting 404 response trying to use v8 API with IIS and Postman

SuiteCRM version 7.10.14

Content-Type = application/vnd.api+json
Accept = application/vnd.api+json

Form Data:

I have read through multiple documents and posts and still can’t get any response other than 404’s with the following URLs and header and body info.

After reading a bunch of posts I see that this is supposed to be a virtual path or redirect and most people say rebuild your .htaccess which obviously doesn’t work for me since I am using IIS. I have attempted to rebuild the web.config but don’t see any API specific redirects in the web.config. And I can’t find and information on which redirect or virtual path to manually create one. As far as a physical path I have both a \lib\API and a \API path.

My first question is which is the correct URL.
Second, what redirects or virtual path to I need to create to get the V8 API working?


I have no idea if this is related, but I recently saw an ongoing discussion about problems with the v8 API on Windows:

There’s a proposed fix there, in case you want to try it

It looks like this problem is partly a an HTTPS problem, which at the time I didn’t think was an issue as I have watched multiple YouTube videos using just HTTP to access the API but apparently they have done some custom changes because by default HTTPS is required.

I installed a SuiteCRM 7.11.10 release on a test Ubuntu VM with Apache2 and MySQL, configured Apache to use SSL and was finally able to request the access token.

The URL to request the access token is HTTPS://domain_or_ip/Api/access_token and according to the .htaccess it IS case sensitive as “api” doesn’t work but “Api” does. Also note that for V8 api calls you should be using “V8” and not “v8” as my first calls to https://domain_or_ip/Api/V8/module/Accounts to get a list of accounts failed when trying them with lowercase api or v8 but then worked when I changed the case to Api and V8.

So I switched back to my IIS live system and generated a self signed SSL cert to test with before installing a full SSL cert. I did another test and I still got a 404 not found message. I suspected that the url redirect / rewrite might be an issue so I went and looked at the URL redirect / rewrite rules in my web.config and it doesn’t seem to be complete as there is no reference to the API redirects like there are in the .htaccess file in my Linux test VM.

Then I went to the Repair section in the Admin panel and ran the “Rebuild web.config file” which is the IIS equivalent to the “Rebuild .htaccess” file for Apache. But instead of telling me it succeeded it just sat at a blank screen. So I figure there is a bug in that function that I will have to look at later and decided to go look more closely at the .htaccess and see if I can duplicate the redirect entries in my web.config. After doing so I no longer got the 404 message, however I simply got an empty response. So I went and checked my error logs and in my PHP errorlog I had the following:

[14-Jan-2020 14:51:43 America/Denver] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Api\Core\Resolver\ConfigResolver::{closure}() must be an instance of Interop\Container\ContainerInterface, instance of Slim\Container given, called in C:\SuiteCRM\SuiteCRM-7.10.14\vendor\pimple\pimple\src\Pimple\Container.php on line 118 and defined in C:\SuiteCRM\SuiteCRM-7.10.14\Api\V8\Config\services\middlewares.php:19
Stack trace:
#0 C:\SuiteCRM\SuiteCRM-7.10.14\vendor\pimple\pimple\src\Pimple\Container.php(118): Api\Core\Resolver\ConfigResolver::{closure}(Object(Slim\Container))
#1 C:\SuiteCRM\SuiteCRM-7.10.14\vendor\slim\slim\Slim\Container.php(109): Pimple\Container->offsetGet(‘League\OAuth2\S…’)
#2 C:\SuiteCRM\SuiteCRM-7.10.14\Api\V8\Config\routes.php(26): Slim\Container->get(‘League\OAuth2\S…’)
#3 C:\SuiteCRM\SuiteCRM-7.10.14\vendor\slim\slim\Slim\RouteGroup.php(25): Api\Core\Loader\RouteLoader->{closure}(Object(Slim\App))
#4 C:\SuiteCRM\SuiteCRM-7.10.14\vendor\slim\slim\Slim\App.php(272): Slim\RouteGroup->__invoke(Object(Slim\App))
#5 C:\SuiteCRM\Suit in C:\SuiteCRM\SuiteCRM-7.10.14\Api\V8\Config\services\middlewares.php on line 19

Do any experienced SuiteCRM Dev’s have any ideas about this before I go looking through the code myself?

If you are using Postman to generate JS code for your access_token API, I found it to work when your body is sent to ‘none’ for your content type.

This is my JS fetch snippet:

var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer Token");

var formdata = new FormData();
formdata.append("grant_type", "client_credentials");
formdata.append("client_id", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
formdata.append("client_secret", "xxxxx");
formdata.append("username", "uname");
formdata.append("schema", "suitecrmv8");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow'

fetch("", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Since container-interop/container-interop is deprecated, simply replace it with Psr\Container\ContainerInterface a try. it works for me.
I hope it will work for you as well.

Best to do this by upgrading to one of the newer version of Suite as all new version include it by default