How to configure Zendesk OAuth Application and Connection for REST API

Introduction

In order to consume Zendesk data using REST API you can use different methods. Now lets see how to create OAuth Application so you don’t have to rely on static Token or use UserID / Password to access data.

OAuth method is more secure and recommended over other methods so whenever possible you should use that method.

Create Zendesk OAuth Application

To create OAuth App for Zendesk perform following steps.

  1. Login to your Zendesk Portal. And go to following URL (This step assume you have admin rights to create OAuth App)
    How to create Zendesk OAuth Application for REST API Access in SSIS

    How to create Zendesk OAuth Application for REST API Access

  2. After click on plus sign and enter app information (e.g. Display name, Unique ID also known as ClientId or AppId )
    Configure Zendesk OAuth App

    Configure Zendesk OAuth App

  3. All the way bottom of that page you will see Secret (i.e. Client Secret). Save that along with unique identifier for later use.
  4. That’s it. Now you can start using Zendesk OAuth App to access REST API

Understanding Scopes

In the next section you will learn how to configure OAuth connection. During that you will need to specify scopes (Token Permissions you want to grant).

Syntax to define scope is as below. Scope can be read, write or read and write. Resource is optional part. If you omit scope will be applied for all.

You can use following resource use scope to the following resources:

  • tickets
  • users
  • auditlogs (read only)
  • organizations
  • hc
  • apps
  • triggers
  • automations
  • targets

Examples of scopes

Calling Zendesk REST API using SSIS PowerPack OAuth Connection

Here is how you can use Zerndesk OAuth to access API using SSIS PowerPack JSON / REST Source

  1. First drag ZS JSON Source from SSIS Toolbox inside Data Flow designer
  2. Configure JSON Source as below. Make sure you change URL as per your domain
  3. Configure OAuth Connection As below. Scopes are very important.
    Configure SSIS OAuth connection for Zendesk API Access

    Configure SSIS OAuth connection for Zendesk API Access

    Configure OAuth Redirect URL for Zendesk

    Configure OAuth Redirect URL and Content Type

  4. After you set necessary parameters click Generate Token (Login using your account with necessary permission needed to access data)
    As of of now Zendesk doesnt support Refresh Token. So once you Click Generate Token it will only create Access Token (doesn’t expire until you revoke explicitly ). Refresh Token will be blank which is expected. 

    OAuth 2.0 Flow (Google API Example)

    Connect to Google API using OAuth 2.0 (Youtube API Example)

    Connect to Google API using OAuth 2.0 (Youtube API Example)

  5. Configure Pagination parameters as below
    SSIS JSON Source - Configure Zendesk REST API Pagination

    SSIS JSON Source –
    Configure Zendesk REST API Pagination

  6. Select Filter
    Select Filter - Extract Data from Zendesk API Response (Read Tickets)

    Select Filter – Extract Data from Zendesk API Response (Read Tickets)

  7. Click Preview to test
    SSIS JSON Source - Data Preview - Zendesk REST API Call to extract tickets

    SSIS JSON Source – Data Preview – Zendesk REST API Call to extract tickets

Adding Retry Settings for HTTP or OAuth connection

Zendesk enforces API rate limit which means you cannot issue too many API calls in a given time frame. Check this document for exact information.

ZappySys provides API retry settings on both OAuth Connection and HTTP Connection. For Zendesk you can retry on a specific status code 429

  1. Open connection manager UI
  2. Go to Retry-Settings page
  3. Select Retry web error on matching response status code.
  4. Enter 429 for status code
  5. Check multiply wait time
  6. In the wait time enter 5000 (wait 5 seconds or multiple of 5 seconds)
  7. Set Max retry count as 6

See below example (Its not for Zendesk but will give you an idea)

Retry Options

Retry Options

Configure Zendesk API Pagination and Filter for SSIS JSON Source

Posted in REST API Integration, SSIS JSON Source (File/REST), SSIS PowerPack, SSIS REST API Task and tagged , , , , , .