Retrieving tickets

Submitted 3/14/2011 by Level 2 Support

With the eStreamDesk API your application can easily retrieve a list of tickets filtered by various criteria in easy to parse and use XML format. This functionality can be used to backup your tickets, import them to other application or create various ticket notification functionality.

The retrieve a list of tickets you need to make a GET request to your Tickets API url:

http(s)://yourcompany.estreamdesk.com/api/tickets

There are two ways to authenticate with the Tickets API:

  • "apikey" header or get parameter - with this authentication the system will provide access to all tickets
  • "email" and "password" headers or get parameters - with this authentication the system will provide access to the tickets depending on the user; if the user is administrator it will provide access to all tickets; if the user is agent the system will provide access only to the tickets that the agent has access to

Here's a sample code to request all tickets in C#:

var webc = new WebClient();
webc.Headers.Add("apikey", "2c76d135322a4b2ba6166ccf7bb9c2cc");
var xmlString = webc.DownloadString("https://yoursite.estreamdesk.com/api/tickets");

And a sample response in XML:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Response>
  <Tickets Page="1" TotalPages="1">
    <Ticket Id="2683">
      <Subject>test</Subject>
      <Labels />
      <Status>Closed</Status>
      <Type>Question</Type>
      <Priority>Normal</Priority>
      <Requester Id="557">
        <Name>John Doe</Name>
        <Email>johndoe@mail.com</Email>
      </Requester>
      <Assignee />
      <Department />
      <Fields />
      <Comments>
        <Comment Id="9498" UserId="557">
          <Date>2009-07-27T02:25:29.217Z</Date>
          <Text>This is a test ticket!</Text>
          <IsPrivate>false</IsPrivate>
        </Comment>
      </Comments>
    </Ticket>
  </Tickets>
</Response>

The Tickets API supports some additonal GET parameters which you can use to filter the results.

  • "id" - specify a specific ticket ID
  • "fromId" - retrieves tickets after that ID; useful for notification application that periodically check for new tickets
  • "fromCommentId" - retrieves tickets with comments after that ID; useful for notification applications that periodically check for new ticket comments
  • "status" - filters by status; supported values are "Open", "Pending", "Solved", "Closed"
  • "type" - filters by type; supported values are "Question", "Problem", "Task"
  • "priority" - filters by priority; supported values are "Low", "Normal", "High", "Urgent"

 

The Ticket API returns tickets in pages of 100 tickets each. The <Tickets> element will contain information about the current page and the total number of pages for your query. If your query returns more than one page you can use the "page" parameter to request the other pages.

<Tickets Page="1" TotalPages="5">