Sample API code - How to create Companies & Contacts

Updated: 07/08/2020
Article #: 216


Cayzu's API allows you to create the following contact/company combinations:

 

  1. Companies that can have associated contact(s) 
  2. Contact that are associated to a company
  3. Contact that doesn't belong to a company (individuals)

 

Note: The token mentioned below will need to be replaced with your own token that you can generate from within Cayzu.  

 

 

1-To create a Company:

 

curl -X POST "https://api.cayzu.com/api/Customer?token=13d118af-d6e7-4251-ab6a-73d01d5474ef"

-H "content-type: application/json"

-d "{\"alternate_domains\": [ \"testdomain1.ttt\" ],

       \"address1\": \"sample string 1\",

       \"address2\": \"sample string 2\",

       \"city\": \"sample string 3\",

       \"company_name\": \"Company #2\",

       \"country\": \"sample string 5\",

       \"is_active\": true,

       \"location\": \"sample string 7\",

       \"notes\": \"sample string 8\",

       \"phone_number\": \"sample string 9\",

       \"postal_code\": \"sample string 10\"

     }"

token - your access token

post body

{

  "alternate_domains": [

    "testdomain1.ttt"

  ],

  "address1": "sample string 1",

  "address2": "sample string 2",

  "city": "sample string 3",

  "company_name": "Company #2",

  "country": "sample string 5",

  "is_active": true,

  "location": "sample string 7",

  "notes": "sample string 8",

  "phone_number": "sample string 9",

  "postal_code": "sample string 10"

}

Response:

 

{

  "id": 94866,

  "errors": [],

  "is_valid": true

}


2-To create a Contact that is associated to a Company:

 

curl -X POST "https://api.cayzu.com/api/Contact?token=13d118af-d6e7-4251-ab6a-73d01d5474ef&customerId=94866"

-H "content-type: application/json"

-d "{ \"notify_by_email\": true,

        \"address1\": \"sample string 2\",

        \"alternate_phone_number\": \"sample string 3\",

        \"city\": \"sample string 4\",

        \"country\": \"sample string 5\", 

        \"description\": \"sample string 6\", 

        \"email_address\": \"testemailaaddr1@gttep.net\",

        \"full_name\": \"sample string 8\",

        \"location\": \"sample string 9\",

        \"phone_number\": \"sample string 10\",  

        \"postal_code\": \"sample string 11\", 

        \"title\": \"sample string 12\"

      }"

 

Parameters:

token - your access token

customerId - customer Id to create under

post body

{

  "notify_by_email": true,

  "address1": "sample string 2",

  "alternate_phone_number": "sample string 3",

  "city": "sample string 4",

  "country": "sample string 5",

  "description": "sample string 6",

  "email_address": "testemailaaddr@gttep.net",

  "full_name": "sample string 8",

  "location": "sample string 9",

  "phone_number": "sample string 10",

  "postal_code": "sample string 11",

  "title": "sample string 12"

}             

 

Response:

{

  "id": 102617,

  "errors": [],

  "is_valid": true

}


3.To create a Contact that doesn't belong to a Company (individual): 

 

curl -X POST "https://api.cayzu.com/api/Individual/CreateContact?token=13d118af-d6e7-4251-ab6a-73d01d5474ef"

 

Parameters:
token - your access token
post body

{
  "notify_by_email": true,

  "address1": "sample string 2",

  "alternate_phone_number": "sample string 25",

  "city": "sample string 25",

  "country": "sample string 5",

  "description": "sample string 6",

  "email_address": "individualtest@tredf.vvv",

  "full_name": "sample string 8",

  "location": "sample string 9",

  "phone_number": "sample string 10",

  "postal_code": "sample string 11",

  "title": "sample string 12"
}

 

Response:

{
    "id": 486236,
    "errors": [],
    "is_valid": true
}

 

 

 

Note:  Click here to view our full API documentation

 

 

Want more information on Cayzu Help Desk? See https://www.cayzu.com







Rate this Topic:
Rating: 5.00 / Votes: 1