Menu
SuiteCRM Pull Request Party hosted by SalesAgility
Welcome, Guest
Username: Password: Remember me

TOPIC: request to api return 404 error

request to api return 404 error 5 days 21 hours ago #76294

  • GSSOCIAL
  • GSSOCIAL's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
Im running SuiteCRM-7.10.11 on virtual server over HTTPS. When I trying post to hostname/crm/api/oauth2/access_token i receive 404 error.

.htaccess checked:
<IfModule mod_rewrite.c>
    Options +SymLinksIfOwnerMatch
    RewriteEngine On
    RewriteBase /c
    RewriteRule ^cache/jsLanguage/(.._..).js$ index.php?entryPoint=jslang&modulename=app_strings&lang=$1 [L,QSA]
    RewriteRule ^cache/jsLanguage/(\w*)/(.._..).js$ index.php?entryPoint=jslang&modulename=$1&lang=$2 [L,QSA]
    
    # --------- DEPRECATED --------
    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]
    RewriteRule ^Api/(.*)$ - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Any advice? Thanks.
The administrator has disabled public write access.

request to api return 404 error 5 days 18 hours ago #76319

  • steveS
  • steveS's Avatar
  • Offline
  • New Member
  • Posts: 8
  • Karma: 0
I have seen several posts with this same problem. None seem to have been resolved. A couple that did get their issue resolved (different issues but might be relevant) seemed to be using /api/oauth/access_token as an endpoint. I am still not sure if it is supposed to be 192.168.XXX.XXX/api/oauth/access_token or 192.168.XXX.XXX/SuiteCRM/api/oauth/access_token but notice that both are "oauth" not "oauth2" so at least you might want to give that a try.

But like other posters I have other variations based on the directory structure like ...Api/V8, ...API/Oauth2 and some others but with no luck. I get a 404 not found error with all of them.

Can anybody please just clarify what the correct endpoint is?

Thanks a lot!
The administrator has disabled public write access.

request to api return 404 error 4 days 21 hours ago #76337

  • GSSOCIAL
  • GSSOCIAL's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
UPD: Noticied some errors in official (docs).

Code to make request via curl in documentation:
$ch = curl_init();
$header = array(
    'Content-type: application/vnd.api+json',
    'Accept: application/vnd.api+json',` //SYNTAX 1
 );
$postStr = json_encode(array(
    'grant_type' => 'client_credentials',
    'client_id' => '3D7f3fda97-d8e2-b9ad-eb89-5a2fe9b07650',
    'client_secret' => 'client_secret',
    'scope' => 'standard:create standard:read standard:update standard:delete standard:delete standard:relationship:create standard:relationship:read standard:relationship:update standard:relationship:delete'
));
$url = 'https://path-to-instance/api/oauth/access_token';
curl_setopt($ch, CURLOPT_URL, url); //SYNTAX 2
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postStr);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$output = curl_exec($ch);

As u can see, we have 2 errors:
1) Line 4 - Symbol "`" at end - 'Accept: application/vnd.api+json',`
2) variale "url" wrote without "$" - curl_setopt($ch, CURLOPT_URL, url)


When I rewrite to code above I have new 404 error :cheer:
"The requested URL /crm/lib/API/public/index.php/oauth/access_token was not found on this server."
$ch = curl_init();
$header = array(
    'Content-type: application/vnd.api+json',
    'Accept: application/vnd.api+json',
);

$postStr = json_encode(array(
    'grant_type' => 'client_credentials',
    'client_id' => '3D7f3fda97-d8e2-b9ad-eb89-5a2fe9b07650',
    'client_secret' => 'client_secret',
    'scope' => 'standard:create standard:read standard:update standard:delete standard:delete standard:relationship:create standard:relationship:read standard:relationship:update standard:relationship:delete'
));
$url = 'https://luckwheel.ru/crm/api/oauth/access_token';
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postStr);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$output = curl_exec($ch);
Last Edit: 4 days 21 hours ago by GSSOCIAL.
The administrator has disabled public write access.

request to api return 404 error 1 day 16 hours ago #76474

  • alanm
  • alanm's Avatar
  • Offline
  • New Member
  • Posts: 8
  • Thank you received: 1
  • Karma: 0
This URL format works for me:
{{suitecrm.url}}/Api/access_token

Note that the Api portion of the URL is case sensitive, using a lowercase api returns a 404.
The administrator has disabled public write access.

request to api return 404 error 21 hours 11 minutes ago #76508

  • steveS
  • steveS's Avatar
  • Offline
  • New Member
  • Posts: 8
  • Karma: 0
Thank you alanm but that still doesn't work for me. It is so frustrating that at least in this forum the number of people that say they can not access the V8 API far exceeds the number of people who seem to have gotten it but there does not seem to any specific or definitive endpoint that works.

This url that worked for you is completely different than what the other posters said they were able to get in with.

I can only guess how many people are spending hours trying every variation of Api, API, api, etc hoping something will work and getting nowhere. I never had any similar issues with v 4_1 and I'm not sure why this should be such a mystery or such a difficult question to answer.

Thank you though for letting us know what worked for you. Maybe that will work for somebody else as well.
The administrator has disabled public write access.
Time to create page: 0.137 seconds
Powered by Kunena Forum