I can’t connect and use the methods that the API provides

Good afternoon, ladies and gentlemen !

I want to connect to CRM, I managed to get “access_token”.


$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' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx',
    'client_secret' => '123',
));
$url = 'http://agencysuite-crm/Api/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(json_decode($output, true));

Tell me, where can I find a description of the API methods?
I tried to find here
https://docs.suitecrm.com/developer/api/version-8/getting-available-resources/, but this method does not work

1.Please throw me a link to access API methods
2.show a code example where I can use Curl, for example, to get a list of users

Hi eretik32,

My apologies for any issues you run into with the API docs, much of it is out of date and is being worked on / tasked out for the next release. Curious that /api/v8/swagger.json isn’t working for you though, have you tried manually going through the browser? it works for me on the latest demo here:

https://demo.suiteondemand.com/api/v8/swagger.json (Username/pass = will/will).

For examples, I would personally suggest trying out this robo script I have created for the V8 api which should generate some postman collections: https://github.com/salesagility/SuiteCRM/pull/7643. Understandably not as ideal as up to date documentation but it should help to point you in the right direction for setting up and using the V8 api.

Thanks so much for the quick reply.
I tried to manually find the file.
Here is the screen, it shows that there is no swagger.json file in this URL

I enter the URL
Http: //agencysuite-crm/api/v8/swagger.json
in the end I get
Page not found
The page you are looking for cannot be found. Check the address bar to make sure your URL is spelled correctly.
I found the swagger.json file in a completely different directory,
agencysuite-URC\Api\Docs\swagger.json
:dry:

I was surprised when I saw json there.

Hi eretik3,

that looks correct to me. The actual swagger.json file will be in Api/docs/swagger/swagger.json but api/v8/swagger.json should route there.

1 Like

Dillon-Brown, hi.
Please show an example Curl request, for example, to this method.
get / module / {module}
I can’t connect, I will be very grateful