Rest API

Resources

The following resources are available:

/api/Tickets
/api/Customers
/api/Services
/api/Operators

Authentication

Every request needs to authenticate using a secret API key. The key can be set on the Settings page. The key is provided as a querystring parameter like this:

/api/Tickets?key=d5XNMpburJBfJVJd

HTTP methods

The resources support GET, POST, PUT and DELETE.

Reading a list:

GET /api/Tickets?key=d5XNMpburJBfJVJd

Reading an entity (in this case with Id=1):

GET /api/Tickets/1?key=d5XNMpburJBfJVJd

Creating an entity:

POST /api/Tickets?key=d5XNMpburJBfJVJd

Updating an entity (in this case with Id=1):

PUT /api/Tickets/1?key=d5XNMpburJBfJVJd

Deleting an entity (in this case with Id=1):

DELETE /api/Tickets/1?key=d5XNMpburJBfJVJd

Media types

The API is built using ASP.NET Web API, and supports both XML and JSON. Just make sure to specify one or the other (or both) in the HTTP header:

GET http://server/api/Tickets?key=d5XNMpburJBfJVJd HTTP/1.1
Accept: application/json, application/xml

Time

All time transferred in/out using the Rest API is UTC. When accessing the API using a Rest library, make sure time is marked as UTC if necessary. Example:

new DateTime(2001, 1, 1, 12, 0, 0, DateTimeKind.Utc)

Updating data

Please note that when updating an entity, the Id must be supplied in the URL as well as in the submitted entity data.

When updating existing entities, it is important to include all properties that you want to keep in the updated entity. For example, if you need to update a customer's email address, you will need to submit the cell phone as well, otherwise it will be erased. You also need to submit the list of services the customer is interested in.

Updating tickets is special, because you will only be able to update some of the properties, i.e. the description, the start and end time, the expected resolution time and the next update time. The closed time or the reopened time can also be set. The other properties will not be updated, whether you include them or not.

Closing and reopening tickets

You can close a ticket by including the property ClosedTime when updating it. You can reopen a ticket by including ReopenedTime when updating it.

Sending email

By default, creating, updating, closing and reopening tickets will cause emails to be delivered, just like when managing tickets using the web GUI. If you don't want emails to be sent, you can include the property DoNotSendEmail=true.

Sample client code

Included with the source code, there are automated tests that show how to do all these operations using RestSharp for .NET.