Zendesk Connector for SSRS : Create tickets (bulk) via SQL

Integrate SSRS and Zendesk
Integrate SSRS and Zendesk

Learn how to create tickets (bulk) using the Zendesk Connector for SSRS. This connector enables you to read and write Zendesk data effortlessly. Manage tickets, users, and organizations — almost no coding required. We'll walk you through the exact setup.

Let's dive in!

Create data source using Zendesk ODBC Driver

  1. Download and install ODBC PowerPack (if you haven't already).

  2. Search for odbc and open the ODBC Data Sources (64-bit):

    Open ODBC Data Source
  3. Create a User data source (User DSN) based on the ZappySys API Driver driver:

    ZappySys API Driver
    Create new User DSN for ZappySys API Driver
    • Create and use a User DSN if the client application runs under a User Account. This is the ideal option at design time (e.g., when developing in Visual Studio). Use it for both types of applications (64-bit and 32-bit).
    • Create and use a System DSN if the client application runs under a System Account (e.g., as a Windows Service). This is usually the required option in a production environment. If your Windows Service is a 32-bit application, you must use the 32-bit ODBC Data Source Administrator to configure this
  4. When the Configuration window appears give your data source a name if you haven't done that already, then select "Zendesk" from the list of Popular Connectors. If "Zendesk" is not present in the list, then click "Search Online" and download it. Then set the path to the location where you downloaded it. Finally, click Continue >> to proceed with configuring the DSN:

    ZendeskDSN
    Zendesk
    ODBC DSN Template Selection
  5. Now it's time to configure the Connection Manager. Select Authentication Type, e.g. Token Authentication. Then select API Base URL (in most cases, the default one is the right one). More info is available in the Authentication section.

    Zendesk authentication

    Authenticate using Static Token instead of userid / password ([Token Access] option must be enabled under Admin Console > Channel > API > Settings and then Click [ADD API Token] to generate new token. These settings typically found here https://YOUR-SUB-DOMAIN.zendesk.com/agent/admin/api/settings [API reference]

    Please refer to external API reference

    API Connection Manager configuration

    Just perform these simple steps to finish authentication configuration:

    1. Set Authentication Type to Token Authentication [Http]
    2. Optional step. Modify API Base URL if needed (in most cases default will work).
    3. Fill in all the required parameters and set optional parameters if needed.
    4. Finally, hit OK button:
    ZendeskDSN
    Zendesk
    Token Authentication [Http]
    https://[$Domain$].zendesk.com/api/v2
    Required Parameters
    Sub Domain (e.g. mycompany) Fill-in the parameter...
    UserId Fill-in the parameter...
    Token Fill-in the parameter...
    Optional Parameters
    RetryMode RetryWhenStatusCodeMatch
    RetryStatusCodeList 429
    RetryCountMax 5
    RetryMultiplyWaitTime True
    ODBC DSN HTTP Connection Configuration
    Zendesk authentication

    OAuth App must be created under Admin Console > Channel > API > Settings. These settings typically found here https://YOUR-SUB-DOMAIN.zendesk.com/agent/admin/api/oauth_clients [API reference]

    Please refer to external API reference

    API Connection Manager configuration

    Just perform these simple steps to finish authentication configuration:

    1. Set Authentication Type to OAuth Authentication [OAuth]
    2. Optional step. Modify API Base URL if needed (in most cases default will work).
    3. Fill in all the required parameters and set optional parameters if needed.
    4. Press Generate Token button to generate the tokens.
    5. Finally, hit OK button:
    ZendeskDSN
    Zendesk
    OAuth Authentication [OAuth]
    https://[$Domain$].zendesk.com/api/v2
    Required Parameters
    Sub Domain (e.g. mycompany) Fill-in the parameter...
    ClientId Fill-in the parameter...
    ClientSecret Fill-in the parameter...
    Permissions Fill-in the parameter...
    RedirectUrl Fill-in the parameter...
    Optional Parameters
    RetryMode RetryWhenStatusCodeMatch
    RetryStatusCodeList 429
    RetryCountMax 5
    RetryMultiplyWaitTime True
    ODBC DSN OAuth Connection Configuration
    Zendesk authentication

    Authenticate using your userid / password (2FA must be OFF and [Password Access] option must be enabled under Admin Console > Channel > API > Settings. These settings typically found here https://YOUR-SUB-DOMAIN.zendesk.com/agent/admin/api/settings [API reference]

    Please refer to external API reference

    API Connection Manager configuration

    Just perform these simple steps to finish authentication configuration:

    1. Set Authentication Type to UserID/Password Authentication (2FA must be OFF) [Http]
    2. Optional step. Modify API Base URL if needed (in most cases default will work).
    3. Fill in all the required parameters and set optional parameters if needed.
    4. Finally, hit OK button:
    ZendeskDSN
    Zendesk
    UserID/Password Authentication (2FA must be OFF) [Http]
    https://[$Domain$].zendesk.com/api/v2
    Required Parameters
    Sub Domain (e.g. mycompany) Fill-in the parameter...
    UserName (2FA Must be OFF) Fill-in the parameter...
    Password Fill-in the parameter...
    Optional Parameters
    RetryMode RetryWhenStatusCodeMatch
    RetryStatusCodeList 429
    RetryCountMax 5
    RetryMultiplyWaitTime True
    ODBC DSN HTTP Connection Configuration

  6. Then go to Preview tab to start building a SQL query.

  7. Once you do that, proceed by opening Query Builder:

    ZappySys API Driver - Zendesk
    Read and write Zendesk data effortlessly. Manage tickets, users, and organizations — almost no coding required.
    ZendeskDSN
    Open Query Builder in API ODBC Driver to read and write data to REST API
  8. Then simply select the Tickets (Bulk) table and Insert operation.

  9. Continue by configuring the Required parameters. You can also set optional parameters too.

  10. Move on by hitting Preview Data button to preview the results.

  11. If you see the results you need, simply copy the generated query:

    Tickets (Bulk)
    Insert
    Advanced Properties
    NextUrlAttributeOrExpr $.next_page
    EnableArrayFlattening False
    MaxArrayItemsToFlatten 5
    Wait time after each request (in milliseconds) 0
    INSERT INTO Tickets_Bulk(_rawdoc_) 
    VALUES(
      '[
        {
          "subject": "Test ticket #1",    
          "comment": {
            "body": "Test ticket #1"
          },
          "priority": "urgent"
        },
        {
          "subject": "Test ticket #2",    
          "comment": {
            "body": "This is a comment for #2"
          },
          "priority": "normal"
        }
      ]'
    )
    Query Builder
  12. Click OK to use built SQL query and close the Query Builder.

  13. Now hit Preview Data button to preview the data using the generated SQL query. If you are satisfied with the result, use this query in SSRS:

    ZappySys API Driver - Zendesk
    Read and write Zendesk data effortlessly. Manage tickets, users, and organizations — almost no coding required.
    ZendeskDSN
    INSERT INTO Tickets_Bulk(_rawdoc_) 
    VALUES(
      '[
        {
          "subject": "Test ticket #1",    
          "comment": {
            "body": "Test ticket #1"
          },
          "priority": "urgent"
        },
        {
          "subject": "Test ticket #2",    
          "comment": {
            "body": "This is a comment for #2"
          },
          "priority": "normal"
        }
      ]'
    )
    API ODBC Driver-based data source data preview
    You can also access data quickly from the tables dropdown by selecting <Select table>.
    A WHERE clause, LIMIT keyword will be performed on the client side, meaning that the whole result set will be retrieved from the Zendesk API first, and only then the filtering will be applied to the data. If possible, it is recommended to use parameters in Query Builder to filter the data on the server side (in Zendesk servers).

Let's not stop here and explore SQL query examples, including how to use them in Stored Procedures and Views (virtual tables) in the next steps.

Zendesk SQL query examples

Use these SQL queries in your SSRS data source:

Bulk create tickets using raw JSON

Creates multiple tickets by supplying a JSON array of ticket objects. This example demonstrates using the _rawdoc_ column with the Tickets_Bulk table to insert multiple tickets at once.

INSERT INTO Tickets_Bulk(_rawdoc_) 
VALUES(
  '[
    {
      "subject": "Test ticket #1",    
      "comment": {
        "body": "Test ticket #1"
      },
      "priority": "urgent"
    },
    {
      "subject": "Test ticket #2",    
      "comment": {
        "body": "This is a comment for #2"
      },
      "priority": "normal"
    }
  ]'
)

post_tickets endpoint belongs to Tickets_Bulk table(s), and can therefore be used via those table(s).

Create SQL view in ODBC data source

ZappySys API Drivers support flexible Query language so you can override Default Properties you configured on Data Source such as URL, Body. This way you don't have to create multiple Data Sources if you like to read data from multiple EndPoints. However not every application support supplying custom SQL to driver so you can only select Table from list returned from driver.

If you're dealing with Microsoft Access and need to import data from an SQL query, it's important to note that Access doesn't allow direct import of SQL queries. Instead, you can create custom objects (Virtual Tables) to handle the import process.

Many applications like MS Access, Informatica Designer wont give you option to specify custom SQL when you import Objects. In such case Virtual Table is very useful. You can create many Virtual Tables on the same Data Source (e.g. If you have 50 URLs with slight variations you can create virtual tables with just URL as Parameter setting.

  1. Go to Custom Objects Tab and Click on Add button and Select Add Table:
    ZappySys Driver - Add Table

  2. Enter the desired Table name and click on OK:
    ZappySys Driver - Add Table Name

  3. And it will open the New Query Window Click on Cancel to close that window and go to Custom Objects Tab.

  4. Select the created table, Select Text Type AS SQL and write the your desired SQL Query and Save it and it will create the custom table in the ZappySys Driver:
    Here is an example SQL query for ZappySys Driver. You can insert Placeholders also. Read more about placeholders here

    SELECT
      "ShipCountry",
      "OrderID",
      "CustomerID",
      "EmployeeID",
      "OrderDate",
      "RequiredDate",
      "ShippedDate",
      "ShipVia",
      "Freight",
      "ShipName",
      "ShipAddress",
      "ShipCity",
      "ShipRegion",
      "ShipPostalCode"
    FROM "Orders"
    Where "ShipCountry"='USA'

    ZappySys Driver - Create Custom Table
  5. That's it now go to Preview Tab and Execute your custom virtual table query. In this example it will extract the orders for the USA Shipping Country only:

    SELECT * FROM "vt__usa_orders_only"
    ZappySys Driver - Execute Custom Virtual Table Query

Create tickets in SSRS via SQL view

  1. Open Visual Studio and create a new SSRS project.

  2. Then add a new Shared Data Source (you can create a non-shared data source inside report too):

    Adding a Data Source in SSRS project
  3. Continue with creating the Shared Data Source. Select Microsoft SQL Server as Type and hit Build button to proceed further:

    Configuring a Data Source to access API data in SSRS project
  4. Once a window opens, configure it similarly. Configure "ZendeskDSN" as database name. Finally, hit Test Connection and OK:

    ZendeskDSN
    Configuring thoroughly a Data Source to access API data in SSRS project
  5. Another window opens, and it should look similarly to this one below which ends the creation of a Data Source:

    DataSource=localhost,5000;Initial Catalog=ZendeskDSN
    How Data Source in SSRS project looks like
  6. Now it's time to create a Dataset. If you don't have a report created, in one of the wizard's steps it will look like this:

    SELECT * FROM Tickets
    Specifying a query in SSRS Dataset to access API data #1
  7. Finally, once you complete the report, similar results will show up:

    ZappySys Data Gateway API data source results

Advanced topics

Creating SQL stored procedures

You can create procedures to encapsulate custom logic and then only pass handful parameters rather than long SQL to execute your API call.

Steps to create Custom Stored Procedure in ZappySys Driver. You can insert Placeholders anywhere inside Procedure Body. Read more about placeholders here

  1. Go to Custom Objects Tab and Click on Add button and Select Add Procedure:
    ZappySys Driver - Add Stored Procedure

  2. Enter the desired Procedure name and click on OK:
    ZappySys Driver - Add Stored Procedure Name

  3. Select the created Stored Procedure and write the your desired stored procedure and Save it and it will create the custom stored procedure in the ZappySys Driver. Here is an example stored procedure for ZappySys Driver. You can insert Placeholders anywhere inside Procedure Body. Read more about placeholders here

    CREATE PROCEDURE [usp_get_orders]
        @fromdate = '<<yyyy-MM-dd,FUN_TODAY>>'
     AS
        SELECT * FROM Orders where OrderDate >= '<@fromdate>';
    
    ZappySys Driver - Create Custom Stored Procedure
  4. That's it now go to Preview Tab and Execute your Stored Procedure using Exec Command. In this example it will extract the orders from the date 1996-01-01:

    Exec usp_get_orders '1996-01-01';
    ZappySys Driver - Execute Custom Stored Procedure

Conclusion

And there you have it — a complete guide on how to create tickets (bulk) in SSRS without writing complex code. All of this was powered by Zendesk ODBC Driver, which handled the REST API pagination and authentication for us automatically.

Download the trial now or ping us via chat if you have any questions or are looking for a specific feature (you can also reach out to us by submitting a ticket):

More actions supported by Zendesk Connector

Got another use case in mind? We've documented the exact setups for a variety of essential Zendesk operations directly in SSRS, so you can skip the trial and error. Find your next step-by-step guide below:

More Zendesk integrations

All
Data Integration
Database
BI & Reporting
Productivity
Programming Languages
Automation & Scripting
ODBC applications