Forums/Community/Zendesk API

Answered

GET Tickets using API

Dennis Monsewicz
asked this on August 04, 2010 08:08

I am using the PHP API that someone posted on this forum to try to make calls into our Zendesk system. However, in trying to grab ALL of the tickets we have in our system, it does not work.

Does anyone know how to make a curl call to grab all of the tickets in the system?

 

Comments

User photo
Jake Holman
Product Manager

Dennis, why would you want to grab all the tickets from the API, out of interest?

August 04, 2010 08:18
User photo
Dennis Monsewicz

I am trying to create system that will display them to the user. Its a sub system I am creating for work to help with message translations.

August 04, 2010 08:20
User photo
Andres Int
dewak

Hi

Have the same problem here, is there any way to get ALL tickets from the help desk without sending the id or view?

I used search.xml but this is limited to 1000 records, which doesn't make sense because my help desk has 2200+ tickets. What can I do?

August 24, 2010 14:39
User photo
Shawn Christopher

Jake,

    We're using GoodData for our data but the way they parse out the Zendesk imported content doesn't really make sense ("We import text, because if we import numbers it breaks things"), which I'm taking to assume the import things into Text in their backend vs. VARCHAR and doing isnumeric or some other function on their side...

ANYWAYS....I'd like to get all the tickets in my system as well...this is due to a field that is numeric only (I know it is) so I can get things like call times and perform normal operators on them, SUM/AVG/Etc. I've already gotten in touch with GoodData and to say the least have a MQL Query that's 6 lines long vs. doing it in one line....

Any suggestions?

November 12, 2010 13:14
User photo
Jake Holman
Product Manager

@Shawn: That flew totally over my head :) Can you dumb it down for me a little please? If you tell me what you need I can probably do something.

@Andres: Plus+ plan enables you to download absolutely everything in your account, which is far more convenient that doing it all by hand via the API.

November 12, 2010 13:27
User photo
Shawn Christopher

Jake,

    When I spoke with GoodData previously I was told that they import Zendesk information as text vs. numeric data because they could format it easier and it "broke things" when they tried to import as numeric. I'm assuming in their database they're importing fields into TEXT specified fields vs. varchar (variable character) or even as INT (integer) based on fields specified by Zendesk.

     However they don't provide their data as 'real data' they provide their data as database objects, so there isn't any true database interaction. Thus when you attempt to query the data in regular SQL syntax it fails, and is very nebula in error response. 

For example, a simple SELECT SUM(Call Time) turns out to be SELECT (SELECT #Tickets WHERE Call Time = x ) * x and this is for one call time NUMBER.

I'm hoping by being able to access ALL my tickets through an API I can iterate through the fields I need and perform any operations I need on them.

November 12, 2010 14:44
User photo
Dan Matthews

I'd like to re-open and bump this request -  is there still no method for getting all tickets by filter (status, tags etc) ? I'm wanting to produce a high-level overview of ticket status for two help desks to place on an in-office statusboard. I'm sure others would find value in this.

Can i propose something more RESTful like:

URL: /tickets

PARAMETERS:
status (single) | /tickets?status=1

Or perhaps an overview / count method for the API like:

URL: /overview

That produces a response similar to:

<response>

<tickets>

<open>341</open>

<new>10</new>

<closed>4456</closed>

</tickets>

</response> ...

January 16, 2012 02:28
User photo
Neil Lillemark
electriccloud

I agree with Dan's comments regarding a means to filter our GET requests.  Currently we must cycle through to GET all tickets, and filter out the data we care about to generate some special reports, but generally speaking, we don't need to bother looking at tickets that have already CLOSED, so we would like to at least be able to run a GET command that only looks at ACTIVE tickets, rather than ALL Tickets.  Since you limit the number of tickets we can get with each poll, this causes a burden on our script to cycle more, and causes your side to have to service more API requests.  So it would be better for both sides if you could offer this level of filtering from the front end.

March 26, 2012 10:19
User photo
Dan

Forget all the fancy stuff, any progress on offering an easy API to download all tickets?

April 02, 2012 15:12
User photo
Steven Yan
Product Manager
Check Answer

Hi everyone, please see:

http://developer.zendesk.com/tickets.html

If you're interested in a real-time list of tickets that have been updated within a certain time period, see:

http://developer.zendesk.com/ticket_export.html

Note the latter API functions very similarly to our CSV export in terms of the data that it exposes.

April 26, 2012 14:01
User photo
Dan

Note for ticket export: "You are only allowed to make 1 API call to this API end point every 5 minute and we will return up to 1000 tickets per request."

Unclear how one goes backwards in time farther than 1000 tickets.

May 01, 2012 14:27
User photo
Steven Yan
Product Manager

Dan, for the incremental ticket export, you supply a timestamp which is your start date.  If you want to start from the very beginning of your tickets, you would request something like:

curl https://domain.zendesk.com/api/v2/exports/tickets.json?start_time=0 -u {email}:{password}

In the response of this request, you would receive a next_page param that will instruct you what your next start_time will be.  You should use this request to retrieve the next batch of tickets until you're caught up to the most recently updated tickets.

{
  "end_time": 1332034771,
  "next_page":"https://domain.zendesk.com/api/v2/exports/tickets.json?start_time=1332034771",
  "field_headers": {
    "group_name": "Group",
    "id": "Id",
    "created_at": "Created at",
    ...
  },
  "results": [
    {
      "group_name": "Support",
      "id": 2,
      "created_at": "2012-02-02T04:31:29Z",
      ...
     },
     ...
  ]
}
May 01, 2012 20:13
User photo
Dan

Great detail. Thanks!

May 01, 2012 20:18
User photo
Sean Morrissey
mmpm

@Steve The links you reference appear to be broken. 

February 01, 2014 22:07
User photo
ZhiWen Tan

@Steven, I am trying to get use the export all API as well. 

March 08, 2014 04:23