Hi, I’m a new user of SuiteCRM, and spent a few hours yesterday with exactly the same problem. I’m using 7.11.0, but assume it’s the same set up as 7.10.11 for the API.
I tracked my issue down, and it was due to Rewriting being turned off (as expected), however not because mod_rewrite was disabled but because the image I’m using (a docker image from bitnami) disables rewriting by default in the apache config files.
“AllowOverride None” needs to be “AllowOverride All” for the .htacess file to function.
The documentation on which URLs are the correct ones for the V8 API isn’t great. The latest docs look to be here: https://deploy-preview-90–suitedocs.netlify.com/developer/api/version-8/json-api-new/ but aren’t quite correct as they omit the use of “/Api/” in the path I.E. it’s “/Api/V8/module” not just “/V8/module”.
I found the access_token URL is: http://mysite/Api/access_token
then if you actually want to do anything once you have the access token you have to parse the token into the header request of the module you’d like to call, with a base url of: http://mysite/Api/V8/module/
Here’s an example in PHP that I’ve been playing with that pulls a list of all accounts:
$token_url = 'http://mysite/Api/access_token';
$module_url = 'http://mysite/Api/V8/module/';
$client_id = '12345678-1234-1234-1234-1234512345';
$client_secret = 'its a secret';
$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' => $client_id,
'client_secret' => $client_secret
));
curl_setopt($ch, CURLOPT_URL, $token_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);
$out = json_decode($output,true);
$ch = curl_init();
$header = array(
'Content-type: application/vnd.api+json',
'Accept: application/vnd.api+json',
'authorization: Bearer '.$out["access_token"]
);
$item = 'Accounts?sort=-name';
curl_setopt($ch, CURLOPT_URL, $module_url . $item);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$output = curl_exec($ch);
echo $output;
I now have another issue to do with permissions, but I’ll make it a new post.