API Documentation

Hi,

Does anyone have a step by step guide for configuring the Suite CRM API?

I have installed composer and I have created my private/public Oauth keys but from there it’s a mystery. I’m not a software engineer / developer.

Any help or better documentation would be great.

Thanks

Karen

Hey K-B,

Have you had a look through the Documentation on the SuiteCRM docs site?:

It should contain all the required setup and pre-requisites

There is also a Thread: https://community.suitecrm.com/t/api-setup-and-example/
Where users have discussed minor issues/resolutions on setting up the API

Hopefully a combination of the above can point in the right direction!
Let us know if you have any issues :slight_smile:

1 Like

Hey @John,

I started at this page. I’ll read the documentation from the beginning and hopefully it helps.

Thanks

Karen

1 Like

There is also a very nice swagger example in Api\docs\swagger (should be compatible with https://editor.swagger.io/).
E: this file is more about the usage in general, not the configuration/setup.

@John,

How/where do I find the response from the PHP curl script? I copied the example, replaced the placeholders and saved the file in my root dir. How do I run the newly created PHP so it will create a token? I visited the PHP page via browser, it was blank.

Sorry for my rookie league questions.

Karen

@crmspace,

Thanks for the resource.

Karen

Can you share the Code chunk that you have and the URL that you are Trying to Access?

Did you setup your file like this code

1 Like

@cherub-chum,

My code was missing a lot of what your link had. I copied the code from your link and added my credentials. I now get an internal 500 error when I visit the page with my PHP.

I’ve removed IP and URL. Both are not publicly accessible anyhow.

*   Trying my-ip...
* TCP_NODELAY set
* Connected to www.team.my-domain.net (my-ip) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=www.team.my-domain.net
*  start date: Aug 17 00:00:00 2020 GMT
*  expire date: Aug 17 23:59:59 2021 GMT
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA
*  SSL certificate verify ok.
> POST /Api/access_token HTTP/1.1
Host: www.team.my-domain.net
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
cache-control: no-cache
Content-Length: 120

* upload completely sent off: 120 out of 120 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
< Date: Mon, 19 Oct 2020 17:16:06 GMT
< Server: Apache/2.4.46 () OpenSSL/1.0.2k-fips
< Upgrade: h2,h2c
< Connection: Upgrade, close
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT
< Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With
< X-Content-Type-Options: nosniff
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Closing connection 0 

Thanks

Karen

Hi,

I fixed the internal 500 error. Had a small permissions error and I changed httpd.conf override to allow All.

Is there any additional documentation on endpoints and creating opportunities via API?

I appreciate everyone’s help!

Karen

Hey,

I’ve found a post on here wherein a user has described steps to create Leads, using the Postman collection that comes with SuiteCRM:




It should be as easy as changing the module “type”, and the field names to those of Opportunities in the “Create Module” POST request in the collection


The JSON API docs page also seems to detail the syntax/some examples of Endpoints:

Do either of the above perhaps point in the right direction?

@John,

Thanks for the links. I had read the post by GrumbleShark. I don’t use Postman, maybe I should, as it might help me better understand things.

I think your second link might be more helpful. Looking at this section. Is this the end point: {{suitecrm.url}}/V8/module and then I would tell SuiteCRM which type of record to create by changing the “type” value? What’s the ID number from/for?

Thanks! I really appreciate you taking the time to help me.

Karen

Hey,
No worries!

I would indeed recommend Postman, I find it quite helpful when playing around with APIs and making sense of requests

I believe that is indeed the right one for creating/updating records, just as long as you replace the {{suitecrm.url}} with your URL of your CRM

and Correct, “type” would indicate the module
ie “Accounts”, “Leads”, “Opportunities”


Regarding the ID, that'd just be the unique ID that the CRM generates/uses for each record: (ie, it can be seen in the URL when viewing a record)

image


Using the example in the documentation:
{
  "data": {
    "type": "Accounts",
    "id": "86ee02b3-96d2-47b3-bd6d-9e1035daff3a",
    "attributes": {
      "name": "Test account"
    }
  }
}

In the POST request, this would create an Account record in the CRM with:
ID: “86ee02b3-96d2-47b3-bd6d-9e1035daff3a
Name: "Test account

However, if you don’t want to force a specific ID onto a record, I believe you can just omit the “ID” parameter, and the CRM will auto-generate an ID when creating the record
So, just:

"data": {
    "type": "Accounts",
    "attributes": {
      "name": "Test account"

However, if you wish to update records via API, (using the PATCH request), you'd have to supply the ID of the record(s) you wish to update.

Hopefully the above makes sense, let me know if you have any questions :slight_smile:

1 Like

Hey @John,

That’s great! I think I have enough understanding now to start attempting it. I’ll download Postman too.

I’ll mark this thread as solved and I’ll open another thread with a reference to this one if I need further help.

Thanks again, I really appreciate the help.

Karen

1 Like