rest api v8

Hi guys, its me again.

I´m trying to use suitecrm api rest v8, i have 7.10.4

I created a new credentials user and i can obtain a token but when i try to list something give me access denied
suggestions?

my code, i´m execution on xamp local host but crm is on bitnami machine on aws

<?php
$ch = curl_init();
$your_saved_access_token = Token obtain in the POST http
$header = array(
   'Content-type: application/vnd.api+json',
   'Accept: application/vnd.api+json',
   'Authorization: Bearer '.$your_saved_access_token
);
$url = 'https://www.crmcheeruptravelgroup.com/api/v8/modules/Accounts';

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

$output = curl_exec($ch);
$data = json_decode($output, TRUE);
var_dump($data);
?>

What exactly are you doing to get the token?

like that

<?php
$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' => 'f8900066-cea1-7036-27fe-5aeb36670855',
    '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://www.crmcheeruptravelgroup.com/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);

var_dump($output);
?>

When i execute this code on xamp i get a token in the response

I wen to the data base and the token is there for the credential user i created.

Can the token be bad decrypted?

Some insight with the keys. I just run the foling comands in the server:

openssl genrsa -out private.key 1024
openssl rsa -in private.key -pubout -out public.key

I´m stoke guys, i need create a costumer portal but without connection with suitrcrm i cant do nothing =(

Sorry, my knowledge of API is very limited, I’ve never used it. Let’s hope someone else comes in here and helps…

I have been using the API v 4_1 successfully for a couple of years through a VB.NET httpwebrequest.
I am trying to use the new V8 API (running SuiteCRM v7.10.11) but cannot get it to connect.
I have set up the Client Credentials Client
If I click on List OAuth2 Tokens I get the error Error: File [modules/OAuth2Tokens/metadata/editviewdefs.php] is missing

When I try to create an httpwebrequest to http://[SuiteCRMIP]/SuiteCRM/api/oauth/access_token I get a 404 error
When I try to create an httpwebrequest to https://[SuiteCRMIP]/SuiteCRM/api/oauth/access_token I get a vb.net error “unable to connect to the remote server” when I try to .GetRequestStream()

I also tried http and https using [SuiteCRMIP]/SuiteCRM/Api/V8/OAuth2/access_token

The same code has been working fine with API v 4_1 and I am just hoping somebody can help me narrow down what I am doing wrong so I can fix the problem

It could be something with my windows system or VB.NET trying to make a https connection instead of a http connection
It could be something with the address /SuiteCRM/api/oauth/access_token address I am trying to use since I don’t see that location in /var/www/html/SuiteCRM
It could have something to do with that modules/OAuth2Tokens/metadata/editviewdefs.php error
or maybe something I am missing or all of the above?

Thanks a lot

I narrowed down part of my problem. First I had to enable SSL on my server and create a self signed certificate.

I had to add this to my code to get past the self-signed certificate
System.Net.ServicePointManager.ServerCertificateValidationCallback = Function(se As Object,
cert As System.Security.Cryptography.X509Certificates.X509Certificate,
chain As System.Security.Cryptography.X509Certificates.X509Chain,
sslerror As System.Net.Security.SslPolicyErrors) True
Now I get a 404 not found error. I am still thinking it is something with the url I am using. I don’t see /SuiteCRM/api/oauth/ on the server. I found /SuiteCRM/Api/V8/OAuth2/ but I don’t see any access_token anywhere in the SuiteCRM directory. Can anybody verify the correct url to use for oauth2 access?

Thanks a lot

I am new to rest api and also having issues like steveS has described. To add to issue I have also configured web.config to change entry point from /api to lib/api/public as per document found at https://deploy-preview-90–suitedocs.netlify.com/developer/api/version-8/configure-suitecrm/

Configuration
SuiteCRM V7.10.11
IIS v10.0.14393.0
PHP v7.2.2

Any help would be appreciated.

alanm found the solution to this. It is posted here:

request-to-api-return-404-error