Create Entity

How to create a new Customer or Supplier.

Request

Field Type Description  
entity company_name string optional
entity contact_name string optional
entity building string optional
entity address1 string optional
entity address2 string optional
entity town string optional
entity county string optional
entity country string Enter a country code as found here. optional
entity postcode string optional
entity email string optional
entity phone1 string optional
entity phone2 string optional
entity fax string optional
entity website string optional
entity external_id integer optional
supplier default_account_code string optional
supplier default_vat_rate string optional
supplier default_credit_terms integer optional
customer default_account_code string optional
customer default_vat_rate string optional
customer default_credit_terms integer optional

Response

Field Type Description  
The return value integer The internal id of the entity optional

Examples

Request

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
  xmlns:cb="https://secure.clearbooks.co.uk/api/soap/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
  <env:Header>
    <cb:authenticate apiKey="yourApiKey" />
  </env:Header>
  <env:Body>
    <env:createEntity env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
      <entity
        company_name="A new company"
        contact_name="Mr Contact Person"
        address1="address1"
        town="town"
        county="county"
        postcode="postcode"
        email="email@address.com"
        phone1="01234 567890"
        xsi:type="cb:Entity">
        <customer
          default_account_code="1001001"
          default_vat_rate="0.15"
          default_credit_terms="30"
          xsi:type="cb:EntityExtra" />
        <supplier
          default_account_code="1001001"
          default_vat_rate="0.15"
          default_credit_terms="30"
          xsi:type="cb:EntityExtra" />
      </entity>
    </env:createEntity>
  </env:Body>
</env:Envelope>

Response

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
  xmlns:cb="https://secure.clearbooks.co.uk/api/soap/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
  <env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc">
    <env:createEntityResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
      <createEntityReturn xsi:type="xsd:int">18</createEntityReturn>
    </env:createEntityResponse>
  </env:Body>
</env:Envelope>