Menu
Welcome, Guest
Username: Password: Remember me

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

I can’t connect and use the methods that the API provides 3 days 1 hour ago #88265

  • eretik32
  • eretik32's Avatar
  • Offline
  • New Member
  • Posts: 1
  • Karma: 0
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
docs.suitecrm.com/developer/api/version-...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
The administrator has disabled public write access.

I can’t connect and use the methods that the API provides 2 days 15 hours ago #88273

  • Dillon-Brown
  • Dillon-Brown's Avatar
  • Offline
  • Administrator
  • Posts: 214
  • Thank you received: 76
  • Karma: 17
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:


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: 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.
The administrator has disabled public write access.

I can’t connect and use the methods that the API provides 2 days 7 hours ago #88282

  • eretik32
  • eretik32's Avatar
  • Offline
  • New Member
  • Posts: 1
  • Karma: 0
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.
The administrator has disabled public write access.

I can’t connect and use the methods that the API provides 2 days 6 hours ago #88289

  • Dillon-Brown
  • Dillon-Brown's Avatar
  • Offline
  • Administrator
  • Posts: 214
  • Thank you received: 76
  • Karma: 17
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.
The administrator has disabled public write access.
The following user(s) said Thank You: eretik32
Time to create page: 0.073 seconds
Powered by Kunena Forum