This file contains hidden or 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
{ | |
"_links": { | |
"company": { | |
"href": "/api/v2/companies/1", | |
"class": "company" | |
} | |
} | |
} |
This file contains hidden or 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
require 'desk_api' | |
# Authentication | |
DeskApi.configure do |config| | |
config.username = '[email protected]' | |
config.password = '1234secret' | |
config.endpoint = 'https://example.desk.com' | |
end | |
# Create the case |
This file contains hidden or 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
Zip::ZipFile.open(zipfile) do |zip| | |
zip.each do |f| | |
path = File.join('/your/aws/path', f.name) | |
aws = AWS::S3.new.buckets['yourbucket'][path] | |
aws.write(file: zip.get_output_stream(f)) | |
aws_url = aws.public_url(secure: true).to_s | |
end | |
end | |
end |
This file contains hidden or 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
BASE_URL: https://desk-oauth-express.herokuapp.com | |
CONSUMER_KEY: MY_CONSUMER_KEY | |
CONSUMER_SECRET: MY_CONSUMER_SECRET | |
SESSION_SECRET: MY_SESSION_SECRET |
This file contains hidden or 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 | |
$json = json_encode(array( | |
"subject" => "Test", | |
"description" => "testing", | |
"message" => array( | |
"subject" => "Test", | |
"body" => "Test", | |
"direction" => "in", | |
"to" => "[email protected]", |
This file contains hidden or 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 | |
use strict; | |
use warnings; | |
use feature qw(say); | |
use JSON; | |
use WWW::Curl::Easy; | |
my $DeskSite = 'https://example.desk.com'; |
This file contains hidden or 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 | |
$json = json_encode(array( | |
'_links' => array( | |
'assigned_user' => array( | |
'href' => '/api/v2/users/16096734', | |
'class' => 'user' | |
) | |
) | |
)); |
This file contains hidden or 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 hidden or 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: '[email protected]', 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: '[email protected]' }] | |
}) |
This file contains hidden or 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; |