API V8 routes don't work

Hello everyone, for the last few days I have been trying to access the Suite API without success.
I did all the steps in the documentation and I managed to access the authentication path correctly, that’s where I got the token from, but the only paths that work for me are the ones offered by the swagger.json file (which can’t even be read in the swagger app), otherwise the paths that the documentation offers don’t work.

I’ve tried ‘module’, ‘modules’, ‘account’, ‘accounts’ but none of them work.

I don’t know what I am doing wrong, I would appreciate if you could help me, with suggestions, with a better guide or with any other help, thank you very much.

I’m using version 7.11.10 running in Apache2 Ububntu, with HTTPS

Hi @esnoan,

The method for accessing a counts should look like this {{suitecrm.url}}/V8/module/Accounts/

Give that a go and let me know if you have any success, there is a chance the pathing you are using for suitecrm.url is incorrect therefore could you provided an example of what yours looks like?

Hi @Mac-Rae thank you for responding
This is the complete route, and trying the route you sent me doesn’t work either :frowning:

Try switching to a GET and try “/Api/V8/module/Accounts”, it is case sensitive on my Ubuntu/Apache2 test setup based on the redirects in the .htaccess file. You also may want to go to the Repair section in the admin panel and run “Rebuild .htaccess file”. I literally just got my access token this morning and saw your post and just tried your path and it didn’t work for me until I changed the case. I am running SuiteCRM 7.11.10 on an Ubuntu VM using Apache2 and Mysql. I set this up to attempt to troubleshoot getting the API to work in my IIS and MS SQL install.

Hi @JosephN
I have already rebuild the .htaccess file several times, and if I change the path to ‘Api’ I get error 500

Hmm, sounds like something else is going on… have you done the composer install or composer upgrade from your “/var/www/Path-to-SuiteCRM”? Mine is just in /var/www/html folder so I just changed directory to that folder and ran sudo composer install or composer upgrade depending on if I had run the install yet.

@JosephN Yes, mine is in “/var/www/html/domain.com” and run ‘composer install’ on that path

Just to confirm, from the Authorisation tab your able to get a token? If you are the connection is there, just something wrong with the way your paths are configured i would think.

Try this;

What happens when you add a ? on the end of that path? do you get any response?

For example
https://your-domain.com/Api/V8/module/Accounts/?

As @JosephN said try using a Get command also

Then try this;

Navigate to the browser and try to hit
https://your-domain.com/Api/

You should get an error back, please let me know what it says

Hi @Mac-Rae, thank you for your comments

Yeah, I get the token and I use it on the routes

with the route you specified for me:

and if I put in the browser “/Api” I get error 500, if I write it as “/api” I get error access denied (for not putting the token)

Looks to me that the .htaccess is not redirecting as it should. Can you confirm if these lines are within your .htaccess?

    # --------- DEPRECATED --------
    RewriteRule ^api/(.*)$ - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteRule ^api/(.*?)$ lib/API/public/index.php/$1 [L]
    # -----------------------------

    RewriteRule ^Api/(.*)$ - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteRule ^Api/access_token$ Api/index.php/access_token [L]
    RewriteRule ^Api/V8/(.*?)$ Api/index.php/V8/$1 [L]

Yes, I do. Could it be some kind of Apache configuration?

Hey @esnoan, did you manage to solve the problem. I am stuck with the same issue.

Hi @esnoan,

Sorry for the delay in responding.

Hitting the URL you provided it appears the .htaccess is configured correctly and is taking action on incoming requests. That lastly leaves me with the API not being configured correctly. Have you used the API before with this instance and if so did you encounter any issues?

Hi @kms97 nop, the error persists :frowning:

np @Mac-Rae nop, this instance is clean install it to test the API

Hi @esnoan,

I’m not too sure then :confused: I’ve been using both the 7.10 and 7.11 latest plus the hotfix branch for testing the API recently and have encountered no issues.

I’m using the following setup, could you let me know yours;
Host: Ubuntu 18.04
Container: Ubuntu 16.04
Service: Apache2 utilising PHP 7.2
Database: Mariadb 10.2

Please note i’m using Docker for the containerised instance which is appropriately configured to allow inbound and outbound traffic

I’m also using Postman to request the access token and make the get requests