Skip to content

Instantly share code, notes, and snippets.


Thomas Stachl tstachl

View GitHub Profile
tstachl / FetchingLabels.class
Created Feb 12, 2014
Shows how you can use the API client to fetch labels from a specific case.
View FetchingLabels.class
try {
DeskClient client = new DeskClient(new Map<String, String>{
'username' => '',
'password' => 'your_password',
'subdomain' => 'your_subdomain'
List<Object> labels = (List<Object>)client.getResource('cases').find(3368).get('labels');
// get the count of the labels
tstachl / customer_theme.html
Created Feb 20, 2014
This shows how you can use javascript to fetch the assigned group from the case tab and based on the value show an additional custom field on the customer theme.
View customer_theme.html
<div class="agent_customer_section" id="my_custom_field" style="display:none;">
$(function() {
var case_assigned_group = $('#edit_customer_{{}}')
.find('#ticket_group_id option:selected')
View reply.json
"direction": "in",
"status": "received",
"to": "Helpdesk <>",
"from": "Jane Doe <>",
"subject": "Replying to a case via the API",
"body": "Please assist me with this case",
"created_at": "2012-05-02T21:38:48Z"
View create_case.json
"type": "email",
"subject": "Creating a case via the API",
"priority": 4,
"status": "open",
"labels": [
"language": "fr",
View email_widget.html
<!--If you already have jquery on the page you don't need to insert this script tag-->
<script src="" type="text/javascript"></script>
<link href="" media="screen" rel="stylesheet" type="text/css" />
<!--If you already have fancybox on the page this script tag should be omitted-->
<script src="" type="text/javascript"></script>
// ********************************************************************************
// This needs to be placed in the document body where you want the widget to render
View create_customer.js'/api/v2/customers', {
"emails": [
"type": "home",
"value": ""
"custom_fields": {
"user_id": null
tstachl / create_qna_case.rb
Created Mar 7, 2014
Creating a QNA case using the ruby wrapper ...
View create_qna_case.rb
require 'desk_api'
DeskApi.configure do |config|
config.username = ''
config.password = 'MyReallySecretPassword'
config.subdomain = 'syncmade'
type: 'qna',
tstachl /
Created Apr 4, 2014
RAuth example with
from rauth import OAuth1Session
import pprint
read_input = raw_input
except NameError:
read_input = input
session = OAuth1Session('YOUR_CONSUMER_KEY',
tstachl / multipass.cs
Last active Aug 29, 2015
C# Multipass example for
View multipass.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.IO;
using System.Web;
using System.Diagnostics;
using System.DirectoryServices;
tstachl / CaseThemeAddition.html
Created Jun 20, 2014
This is some javascript and css code that allows you to have tabbed email and note replies in
View CaseThemeAddition.html
$(function() {
var tid = $('#tabs .ui-state-active a').attr('href').replace('#tabs-tid_', '')
, sel = '#email_reply_div_tid_' + tid
setTimeout(function() {
' <ul class="reply-toggle">',
' <li class="active">',