Creating leads with the V8 API - How To

I’ve just spent some time with the V8 API, and I wanted to post here in the hopes it may help others.

My goal was to create leads in SuiteCRM using the Rest API. You’ll want to follow the docs here to get the API up and running:

Next you’ll want to download Postman. It’s the standard for working with APIs (from what I’ve read).
Once installed you’ll want to import (file->import) a file from SuiteCRM - \Api\docs\postman\SalesAgility.postman_collection.json

This will give you a quick overview of how the API works.

Go to “Create module” on the left, then “Authorization” on the right, and get a new access token. You’ll need to enter info here from your SuiteCRM installation

You’ll want to either add a variable (Settings -> Globals), or change the POST field to reference your SuiteCRM installation

Now, click on the “body” tab and replace what’s there with the following

{
  "data": {
   "type": "Leads",
    "attributes": {
      "name": "Terrible Terry",
      "first_name": "Terrible",
      "last_name": "Terry",
     "email1": "terry@terrible.com",
      "account_name": "Terrible Terrys INC"
   }
  }
}

When you hit “send” it should create a lead in your SuiteCRM called Terrible Terry. if you look at the bottom of postman, in the Body section, you’ll see all the available fields.

This should give you the bare bones to begin adding leads to SuiteCRM using the API. I would note that this will create a new lead, even if one with the same name already exists.

2 Likes

When I try that I get:

Method not allowed

Method not allowed. Must be one of: POST, PATCH