addCrmClient
The method allows you to add a new CRM client. Adding a client with the same crm_client_id again will update the previously saved client (only the provided fields will be changed).
Input parameters
Output data:
A sample request in PHP:
| crm_client_id | int | CRM client ID. If provided and greater than 0, the existing client will be updated. If 0 or omitted, a new client will be created. |
| status_id | int | CRM client status ID. |
| star | int | Star type. Values from 0 to 5. 0 means no star. |
| contractor_id | int | Base Connect contractor ID associated with the client (the list can be retrieved with getConnectIntegrationContractors method). |
| login | varchar(156) | Client login name. |
| phone | varchar(156) | Client phone number. |
| varchar(220) | Client email address. | |
| notes | text | Client notes. |
| invoice_company | varchar(500) | Invoice company name. |
| invoice_fullname | varchar(500) | Invoice full name. |
| invoice_address | varchar(500) | Invoice address. |
| invoice_postcode | varchar(20) | Invoice postcode. |
| invoice_city | varchar(100) | Invoice city. |
| invoice_state | varchar(35) | Invoice state/province. |
| invoice_country_code | varchar(2) | Invoice country code (ISO 3166-1 alpha-2). |
| invoice_tax_id | varchar(50) | Invoice tax ID (NIP). Whitespace and dashes are automatically removed. |
| delivery_company | varchar(500) | Delivery company name. |
| delivery_fullname | varchar(500) | Delivery full name. |
| delivery_address | varchar(500) | Delivery address. |
| delivery_postcode | varchar(20) | Delivery postcode. |
| delivery_city | varchar(100) | Delivery city. |
| delivery_state | varchar(35) | Delivery state/province. |
| delivery_country_code | varchar(2) | Delivery country code (ISO 3166-1 alpha-2). |
| custom_extra_fields | array | A list containing CRM client custom extra fields, where the key is the extra field ID and value is an extra field content for given extra field. The list of extra fields can be retrieved with getCrmClientExtraFields method. In case of removing a field the empty string is expected. In case of file the following format is expected: { "title": "file.pdf" (varchar(40) - the file name) "file": "data:4AAQSkZJRgABA[...]" (base64 - the file body limited to 2MB) } |
Output data
The method returns the data in JSON format.
| status | varchar(30) | SUCCESS - request executed correctly ERROR - an error occurred during an API request. Error details will be described in 2 additional returned fields: error_message and error_code |
| crm_client_id | int | ID of the created or updated CRM client. |
Sample
Input data:Output data:
A sample request in PHP: