api/oauth/access_token

Hi,

I am new in suitecrm v8 REST API. I am following https://docs.suitecrm.com/developer/api/version-8/configure-authentication/ URL for creating APIs.

For creating access token below code I am using:

$header = array(
‘Content-type: application/vnd.api+json’,
‘Accept: application/vnd.api+json’
);

$postStr = json_encode(array(
‘grant_type’ => ‘client_credentials’,
‘client_id’ => ‘XXXXXXXXXXXXXXXXX’,
‘client_secret’ => ‘XXXXXX’,
‘scope’ => ‘standard:create standard:read standard:update standard:delete standard:delete standard:relationship:create standard:relationship:read standard:relationship:update standard:relationship:delete’
));

$url = ‘http://localhost/suitecrm7.10.2/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);
$response = json_decode($output, true);

var_dump( $response );

I am not getting any response :frowning:

Could you please help me to resolve this issue ?

You should setup SSL aka HTTPS for the API ! RTFM bro …

1 Like

Thanks It works for me

Its not working can you help me with ur code which one is working for you