Endpoint Upsert Organization - Create or Update
Name
upsert_organization
Description
Create or Update an organization in (Upsert) [API reference]
Related Tables
Parameters
| Parameter | Required | Options | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| There are no parameters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Output Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | Description |
|---|---|---|---|---|
| id |
DT_I8
|
bigint
|
||
| name |
DT_WSTR
|
nvarchar(500)
|
500 | |
| notes |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| created_at |
DT_DBTIMESTAMP
|
datetime
|
||
| details |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| domain_names |
DT_WSTR
|
nvarchar(144)
|
144 | |
| domain_names_1 |
DT_WSTR
|
nvarchar(255)
|
255 | |
| domain_names_2 |
DT_WSTR
|
nvarchar(255)
|
255 | |
| domain_names_3 |
DT_WSTR
|
nvarchar(255)
|
255 | |
| external_id |
DT_WSTR
|
nvarchar(500)
|
500 | |
| group_id |
DT_I8
|
bigint
|
||
| shared_comments |
DT_BOOL
|
bit
|
||
| shared_tickets |
DT_BOOL
|
bit
|
||
| tags |
DT_WSTR
|
nvarchar(144)
|
144 | |
| tags_1 |
DT_WSTR
|
nvarchar(500)
|
500 | |
| tags_2 |
DT_WSTR
|
nvarchar(500)
|
500 | |
| tags_3 |
DT_WSTR
|
nvarchar(500)
|
500 | |
| tags_4 |
DT_WSTR
|
nvarchar(500)
|
500 | |
| tags_5 |
DT_WSTR
|
nvarchar(500)
|
500 | |
| updated_at |
DT_DBTIMESTAMP
|
datetime
|
||
| url |
DT_WSTR
|
nvarchar(500)
|
500 | |
| organization_field_dt_[$parent.key$] |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| organization_field_[$parent.key$] |
DT_WSTR
|
nvarchar(4000)
|
4000 |
Input Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | Description |
|---|---|---|---|---|
| id |
DT_I8
|
bigint
|
||
| name |
DT_WSTR
|
nvarchar(500)
|
500 | |
| notes |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| external_id |
DT_WSTR
|
nvarchar(500)
|
500 | |
| group_id |
DT_I8
|
bigint
|
||
| details |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| tags |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| organization_fields |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| domain_names |
DT_WSTR
|
nvarchar(1000)
|
1000 | |
| shared_comments |
DT_BOOL
|
bit
|
||
| shared_tickets |
DT_BOOL
|
bit
|
Examples
SSIS
Use Zendesk Connector in API Source or in API Destination SSIS Data Flow components to read or write data.
API Destination
This Endpoint belongs to the Organizations table, therefore it is better to use it, instead of accessing the endpoint directly. Use this table and table-operation pair to upsert organization - create or update:
| There are no parameters to configure. |
ODBC application
Use these SQL queries in your ODBC application data source:
Upsert an organization
<p>Creates a new organization or updates an existing one. This example demonstrates using the <code>UPSERT INTO</code> statement, identifying the organization by ID or external ID.</p>
UPSERT INTO Organizations
(
name
--id or external_id can be supplied for UPSERT
,id
--or--
,external_id
,group_id
,tags
,details
,notes
,organization_fields
,domain_names
,shared_tickets
,shared_comments
)
VALUES(
'Abc Inc'
,1234567 --id
--or--
,'zcrm_1558554000052161270' --external_id
,114094762733
,'["paid","trial","solved"]'
,'some details'
,'some notes'
,'{"startdate": "1981-01-23", "revenue": 12000000.50, "somenumber": 1235678}'
,'["aaa.com", "bbb.com"]'
,'false'
,'false'
)
Bulk upsert users/organizations using SQL Server data
<p>Upserts users or organizations in bulk using data from a SQL Server database. This example demonstrates using the <code>UPSERT INTO ... SOURCE</code> syntax to read data from an external source and import it into Zendesk.</p>
UPSERT INTO Organizations
SOURCE('MSSQL' --ODBC
, 'Data Source=localhost;Initial Catalog=test;Integrated Security=true'
--For bulk input, map columns in External Query (Must use alias column name to match INSERT command Input Column names - see help file)
--If parameter value not same for all input rows then you can prefix some column with $$ to map as parameter (i.e. $$MyParam1)
--'ODBC', 'Driver={ZappySys CSV Driver};DataPath=C:\AccountsToInsert.csv'
--'ODBC', 'DSN=MyDSN'
--'OLEDB', 'Provider=SQLNCLI11;Server=localhost,1433;Database=tempdb;Trusted_Connection=yes;'
, 'select
21863188631451 as id
, ''Abc Inc'' as name
,''zcrm_1558554000052161270'' as external_id
,114094762733 as group_id
,''["paid","trial","solved"]'' as tags
,''some details'' as details
,''some notes'' as notes
,''{"startdate": "1981-01-23", "revenue": 12000000.50, "somenumber": 1235678}'' as organization_fields
,''["aaa.com", "bbb.com"]'' domain_names
,''false'' as shared_tickets
,''false'' as shared_comments
')
upsert_organization endpoint belongs to
Organizations
table(s), and can therefore be used via those table(s).
SQL Server
Use these SQL queries in SQL Server after you create a data source in Data Gateway:
Upsert an organization
<p>Creates a new organization or updates an existing one. This example demonstrates using the <code>UPSERT INTO</code> statement, identifying the organization by ID or external ID.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'UPSERT INTO Organizations
(
name
--id or external_id can be supplied for UPSERT
,id
--or--
,external_id
,group_id
,tags
,details
,notes
,organization_fields
,domain_names
,shared_tickets
,shared_comments
)
VALUES(
''Abc Inc''
,1234567 --id
--or--
,''zcrm_1558554000052161270'' --external_id
,114094762733
,''["paid","trial","solved"]''
,''some details''
,''some notes''
,''{"startdate": "1981-01-23", "revenue": 12000000.50, "somenumber": 1235678}''
,''["aaa.com", "bbb.com"]''
,''false''
,''false''
)';
EXEC (@MyQuery) AT [LS_TO_ZENDESK_IN_GATEWAY];
Bulk upsert users/organizations using SQL Server data
<p>Upserts users or organizations in bulk using data from a SQL Server database. This example demonstrates using the <code>UPSERT INTO ... SOURCE</code> syntax to read data from an external source and import it into Zendesk.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'UPSERT INTO Organizations
SOURCE(''MSSQL'' --ODBC
, ''Data Source=localhost;Initial Catalog=test;Integrated Security=true''
--For bulk input, map columns in External Query (Must use alias column name to match INSERT command Input Column names - see help file)
--If parameter value not same for all input rows then you can prefix some column with $$ to map as parameter (i.e. $$MyParam1)
--''ODBC'', ''Driver={ZappySys CSV Driver};DataPath=C:\AccountsToInsert.csv''
--''ODBC'', ''DSN=MyDSN''
--''OLEDB'', ''Provider=SQLNCLI11;Server=localhost,1433;Database=tempdb;Trusted_Connection=yes;''
, ''select
21863188631451 as id
, ''''Abc Inc'''' as name
,''''zcrm_1558554000052161270'''' as external_id
,114094762733 as group_id
,''''["paid","trial","solved"]'''' as tags
,''''some details'''' as details
,''''some notes'''' as notes
,''''{"startdate": "1981-01-23", "revenue": 12000000.50, "somenumber": 1235678}'''' as organization_fields
,''''["aaa.com", "bbb.com"]'''' domain_names
,''''false'''' as shared_tickets
,''''false'''' as shared_comments
'')';
EXEC (@MyQuery) AT [LS_TO_ZENDESK_IN_GATEWAY];
upsert_organization endpoint belongs to
Organizations
table(s), and can therefore be used via those table(s).