SQL examples for ODBC
The ZappySys API Driver is a user-friendly interface designed to facilitate the seamless integration of various applications with the Hubspot API. With its intuitive design and robust functionality, the ZappySys API Driver simplifies the process of configuring specific API endpoints to efficiently read or write data from Hubspot.
On this page you will find some SQL examples which can be used for API ODBC Driver or Data Gateway API Connector.
Get companies
Gets companies
SELECT * FROM Companies --Where Id=123
Learn more about this SQL query.
Get contacts
Gets contacts
SELECT * FROM Contacts --Where Id=123
Learn more about this SQL query.
Get contact by Id
Gets contact by Id
SELECT * FROM Contacts Where Id=51
Learn more about this SQL query.
Get contact by email (search)
Gets contacts
SELECT Id
, IsArchived
, CreatedAt
, UpdatedAt
, email
, firstname
, lastname
, company_size
--, custom_checkbox
--, custom_multi_select
--, custom_number
--, custom_pickuser
--, custom_richtext
--, custom_string
--, custom_string_multi
FROM search_contacts
With(SearchFilters='[ {"propertyName": "email", "operator": "EQ", "value": "bh@hubspot.com" } ]')
Learn more about this SQL query.
Get deals
Gets deals
SELECT * FROM Deals --Where Id=123
Learn more about this SQL query.
Get line items
Gets line items
SELECT * FROM LineItems --Where Id=123
Learn more about this SQL query.
Get owners
Gets owners
SELECT * FROM Owners
Learn more about this SQL query.
Get products
Gets products
SELECT * FROM Products --Where Id=123
Learn more about this SQL query.
Get tickets
Gets tickets
SELECT * FROM Tickets
Learn more about this SQL query.
Get quotes
Gets quotes
SELECT * FROM Quotes
Learn more about this SQL query.
Generic Request (Company Search API Example)
This example shows how to invoke generic request when connector file doesnt have specific EndPoint / Table you like to query. This example invokes search endpoint but you can call any valid API endpoint GET/POST etc with this method
SELECT *
FROM generic_request
WITH(
Url='crm/v3/objects/companies/search'
,Filter='$.results[*]'
,RequestContentTypeCode='ApplicationJson'
,RequestMethod='POST'
,RequestData='{
"filters": [ {"propertyName": "hs_lastmodifieddate", "operator": "GT", "value": "<<yearstart-1y||unix_timestamp_ms,FUN_TO_DATE>>" } ],
"properties": ["address","city","state"]
}'
)
Learn more about this SQL query.
Upload File (Generic Request Example)
This example shows how to upload a file using generic request. You might have to add file-manager-permission to your OAuth App else you might get message=This oauth-token (CJT87I6) does not have proper permissions! (requires any of [file-manager-access]). For more information please refer to this link https://developers.hubspot.com/docs/api/files/files
SELECT *
FROM generic_request
WITH(
Url='filemanager/api/v3/files/upload'
, RequestMethod='POST'
, Filter ='$.objects[*]'
, Body='file=@c:\temp\dump.png
folderPath=/
fileName=my_dump.png
options={"access": "PRIVATE", "overwrite": true}'
, IsMultiPart='True'
, Meta='id:long; name:string; title:string; url: string; type:string; size:long; friendly_url:string; meta.allows_anonymous_access:string; meta.indexable:bool'
)
Learn more about this SQL query.
Insert into Contacts
Inserts contacts
INSERT INTO Contacts(email, firstname, lastname,custom_checkbox, custom_date, custom_number)
VALUES ('john.doe@abc.com', 'John', 'Doe','true','2023-01-01', 100.55)
Learn more about this SQL query.
Update Contacts
Updates contacts in your account
UPDATE Contacts
SET firstname = 'Brian'
,lastname = 'Halligan (Sample Contact)'
--,custom_number=12.12
--,custom_date='2023-01-01'
--,custom_string='My Test<<FUN_NOW>>'
--,custom_richtext='<p><span style="color: #b5b5b5;">##-Please reply-##</span></p>'
--,custom_multi_select='Blue;Yellow;Black'
--,custom_pickuser=45581955
--,custom_dropdown='BB'
--,custom_checkbox='true'
WHERE Id = 51
Learn more about this SQL query.
Delete a contact
Deletes a contact
DELETE FROM Contacts Where Id=1234
Learn more about this SQL query.
Create multiple records - (BULK read / write from external source)
This examples shows how to perform bulk update using SOURCE clause. It reads data from external system (in this example MS SQL Server) and sends data to Hubspot using Bulk API
INSERT INTO Contacts
SOURCE(
'MSSQL' --ODBC or OLEDB
,'Data Source=localhost;Initial Catalog=Test;Integrated Security=true'
,'
''bob'' as firstname, ''rock'' as firstname, ''new-email1@abc.com'' as email
UNION
''sam'' as firstname, ''smith'' as firstname, ''new-email2@abc.com'' as email
)
Learn more about this SQL query.
Delete multiple records - (BULK read / write from external source)
This examples shows how to perform bulk delete using SOURCE clause. It reads data from external system (in this example MS SQL Server) and sends data to Hubspot using Bulk API
DELETE FROM Contacts
SOURCE(
'MSSQL' --ODBC or OLEDB
,'Data Source=localhost;Initial Catalog=Test;Integrated Security=true'
,'select 104897 as Id
UNION
select 104898 as Id'
)
Learn more about this SQL query.
Update multiple records - (BULK read / write from external source)
This examples shows how to perform bulk update using SOURCE clause. It reads data from external system (in this example MS SQL Server) and sends data to Hubspot using Bulk API
UPDATE Contacts
SOURCE(
'MSSQL' --ODBC or OLEDB
,'Data Source=localhost;Initial Catalog=Test;Integrated Security=true'
,'select 104811 as Id, ''new-email1@abc.com'' as email
UNION
select 104812 as Id, ''new-email2@abc.com'' as email
)
Learn more about this SQL query.
Getting Started with Examples
ZappySys API Driver is a powerful software solution designed to facilitate the extraction and integration of data from a wide range of sources through APIs. Its intuitive design and extensive feature set make it an essential asset for any organization dealing with complex data integration tasks.
To get started with examples using ZappySys API Driver, please click on the following applications:
Key features of the ZappySys API Driver include:
The API ODBC driver facilitates the reading and writing of data from numerous popular online services (refer to the complete list here) using familiar SQL language without learning complexity of REST API calls. The driver allows querying nested structure and output as a flat table. You can also create your own ODBC / Data Gateway API connector file and use it with this driver.
Intuitive Configuration: The interface is designed to be user-friendly, enabling users to easily set up the specific API endpoints within Hubspot without requiring extensive technical expertise or programming knowledge.
Customizable Endpoint Setup: Users can conveniently configure the API endpoint settings, including the HTTP request method, endpoint URL, and any necessary parameters, to precisely target the desired data within Hubspot.
Data Manipulation Capabilities: The ZappySys API Driver allows for seamless data retrieval and writing, enabling users to fetch data from Hubspot and perform various data manipulation operations as needed, all through an intuitive and straightforward interface.
Secure Authentication Integration: The driver provides secure authentication integration, allowing users to securely connect to the Hubspot API by inputting the necessary authentication credentials, such as API tokens or other authentication keys.
Error Handling Support: The interface is equipped with comprehensive error handling support, ensuring that any errors or exceptions encountered during the data retrieval or writing process are efficiently managed and appropriately communicated to users for prompt resolution.
Data Visualization and Reporting: The ZappySys API Driver facilitates the seamless processing and presentation of the retrieved data from Hubspot, enabling users to generate comprehensive reports and visualizations for further analysis and decision-making purposes.
Overall, the ZappySys API Driver serves as a powerful tool for streamlining the integration of applications with Hubspot, providing users with a convenient and efficient way to access and manage data, all through a user-friendly and intuitive interface.