{% extends "helpdesk/help_base.html" %} {% block title %}Jutda Helpdesk API Documentation{% endblock %} {% block heading %}Jutda Helpdesk API Documentation{% endblock %} {% block content %}

Contents

Introduction

Jutda Helpdesk provides a powerful API to allow you to interact with your helpdesk tickets by a means not otherwise provided by the helpdesk.

For example, you may use this API to implement a system to automatically open a ticket when an invoice is raised in your invoicing system, or to automatically close a ticket from an instant messenger application.

Your use of this system is open-ended: most business cases should be addressible with a little bit of coding to allow you to interact nicely with your helpdesk.

Request Basics & Authentication

All requests to the API must be made using HTTP POST requests. Any request that is not made using POST will raise an error.

Your requests must be made up of the following elements:

  1. A method, or action. This tells the API what core functionality to execute.
  2. A username and password which are valid and active within your helpdesk system. You may wish to create a specific API user just for API usage.
  3. A set of data to be saved into the database. This data will vary from request to request, and is outlined in Methods below.

To build your request, send a HTTP POST request to {% url helpdesk_api "method" %}, where method is the name of a valid method from the list below.

Your POST must include both user and password parameters.

A sample request for the method hold_ticket may look like this:

To complete this from a command-line using the cURL application, you may use a command such as this:

/usr/bin/curl {% url helpdesk_api "hold_ticket" %} --data "user=susan&password=fido&ticket=31794"

In PHP, providing you have access to the cURL libraries, you may use code such as this:

<?php
$api = curl_init();
curl_setopt($api, CURLOPT_URL, "{% url helpdesk_api "hold_ticket" %}");
curl_setopt($api, CURLOPT_POST, 1);
curl_setopt($api, CURLOPT_POSTFIELDS, "user=susan&password=fido&ticket=31794");
$result = curl_exec($api);
curl_close($api);
echo $result;
?>

Note that cURL expects all data to be urlencoded, this is left as an exercise for the reader.

Responses

The API system makes proper use of the following HTTP response codes:

200
OK - Data updated successfully
400
ERROR - Generic error. See returned text for details
404
ERROR - Data not found (eg, incorrect ticket). See returned text for details
403
ERROR - Invalid permissions (eg, incorrect username and/or password)
405
ERROR - Invalid method. You probably tried using GET, PUT or DELETE however we require POST.

Responses will have one of two content-types:

text/plain
Any error messages, or simple responses (eg a ticket ID)
text/json
Any complex responses, such as a list of data.

Method Documentation

The following public methods are available for use via the API. Each of them requires a valid request and authentication, and each has it's own parameters as described below.

create_ticket

This method creates a new helpdesk ticket.

Parameters

queue
Queue ID (use list_queues to get queue ID's) - this is an integer field.
title
Title or header of this ticket. Character field, maximum 100 characters.
submitter_email
(Optional) e-mail address of the person submitting this ticket. This e-mail address will receive copies of all public updates to this ticket, and will receive a notification when the ticket is created.
assigned_to
(Optional) Integer ID of the user to which this ticket should be assigned. Use find_user to find a user ID from a username.
priority
(Optional) Priority as an integer from 1 (high) to 5 (low). Defaults to 3 if no priority given.

Response

This method responds with plain-text.

If you receive a 200 OK response, then the content of the response will be the ticket ID.

delete_ticket

When given a ticket ID and confirmation, this method will delete a ticket entirely. This also deletes any followups, attachments, and other details.

Parameters

ticket
The numeric ticket ID to be deleted
confirm
You must provide this field, with any value, to enable deletion to continue

Response

A standard 200 OK response is given on success, or an error message on failure.

hold_ticket

If a ticket needs to be placed on hold, preventing it from being escalated, use this method.

Parameters

ticket
The numeric ticket ID to be placed on hold

Response

A standard 200 OK response is given on success, or an error message on failure.

unhold_ticket

If a ticket is currently on hold and you wish to remove that hold, use this method.

Parameters

ticket
The numeric ticket ID to be taken off hold

Response

A standard 200 OK response is given on success, or an error message on failure.

add_followup

This method adds a comment / followup to a ticket. The followup can be public, in which case it is e-mailed to the submitter, or private. The followup will also be sent to others involved in the ticket: The owner and the queue notification / CC address.

Parameters

ticket
The numeric ticket ID to which this followup should be added
message
Text of 'unlimited' length - optionally formatted with HTML - to add to the message.
public
Either 'y' for public, or 'n' for private. This is optional, and it is assumed that followups are private if it is not provided. Private tickets are not e-mailed to the ticket submitter.

Response

A standard 200 OK response is given on success, or an error message on failure.

resolve

This method adds a resolution to a ticket and marks it as resolved. The resolution will be e-mailed to everybody involved with the ticket, including the submitter.

Parameters

ticket
The numeric ticket ID to which this followup should be added
resolution
Text of 'unlimited' length - optionally formatted with HTML. This is the resolution for this ticket.

Response

A standard 200 OK response is given on success, or an error message on failure.

list_queues

This method provides a JSON-parsable list of queues, letting you access the individual queue ID in order to create tickets.

Response

This method responds with json.

It provides a list of queues in JSON format. The fields provided are ID and Title.

find_user

When given a username, this method provides the related numeric user ID - commonly used when creating or reassigning tickets.

Parameters

username
The case-sensitive username of the user for which you require the user ID

Response

This method responds with plain-text.

If you receive a 200 OK response, then the content of the response will be the users ID.

{% endblock %}