This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
function nextPage(url, callback) { | |
$.get(url, function(data, textStatus, jqXHR) { | |
var cases = $(data).find('.mycases tbody tr') | |
, nextUrl = $(data).find('#pagination a.next_page'); | |
callback(cases); | |
if (nextUrl && nextUrl.attr('href')) nextPage(nextUrl.attr('href'), callback); | |
}, 'html'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# configure the client | |
client = DeskApi::Client.new username: 'support@example.com', password: '$uper$ecretP@ssword', endpoint: 'https://example.desk.com' | |
# create the customer using a plain request | |
resp = client.post('/api/v2/customers', { | |
first_name: 'John', | |
last_name: 'Doe', | |
emails: [{ type: 'home', value: 'jdoe@example.net' }] | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use Digest::SHA qw( sha1 hmac_sha1 ); | |
use Crypt::Random qw( makerandom_octet ); | |
use DateTime; | |
use JSON; | |
use Crypt::CBC; | |
use Digest::HMAC; | |
use URL::Encode qw( url_encode_utf8 ); | |
use MIME::Base64::Perl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -L https://example.desk.com/api/v2/cases/3061/attachments/82558857/url -u agent@example.com:password > my_image.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function post($path, $json) { | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://site.desk.com$path"); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_USERPWD, "my-email:my-password"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $json); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$date = new DateTime('2015-01-21T20:34:53Z'); | |
$date->setTimezone(new DateTimeZone('Pacific/Chatham')); | |
echo $date->format(DateTime::ISO8601); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='input-block'> | |
<span class='label'> | |
CUSTOM FIELD LABEL <span>({{system.snippets.required}})</span> | |
</span> | |
<div> | |
{{ ticket_custom_**CUSTOM FIELD KEY** }} | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "email", | |
"subject": "Email Case Subject", | |
"priority": 4, | |
"status": "open", | |
"labels": [ | |
"Spam", | |
"Ignore" | |
], | |
"message": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if case.group.name == 'Support' %} | |
<!-- put the case theme for support here --> | |
{% elsif case.group.name == 'Internal' %} | |
<!-- put the case theme for internal here --> | |
{% else %} | |
<!-- put the case theme for default here --> | |
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>{{email.subject}}</h2> | |
{% if email.subject contains 'Suggestion' %} | |
<h3>This is a suggestion</h3> | |
{% else %} | |
<h3>This is default</h3> | |
{% endif %} |