Skip to content

Instantly share code, notes, and snippets.

@brendanc
Last active September 27, 2015 22:58
Show Gist options
  • Select an option

  • Save brendanc/1345573 to your computer and use it in GitHub Desktop.

Select an option

Save brendanc/1345573 to your computer and use it in GitHub Desktop.
Create a Litmus Email Test using the Litmus Resller API and Perl
#!/usr/bin/perl
use 5.006;
use SOAP::Lite 'trace', 'debug' ;
# Sample code to create a new email test using Litmus' Reseller Api
# This sample uses SOAP:Lite, available at: http://www.soaplite.com/
$api_key = "api-key";
$api_password = "api-password";
$api_ns = "https://soapapi.litmusapp.com/";
$api_types = "https://soapapi.litmusapp.com/encodedTypes";
$api_url = "https://soapapi.litmusapp.com/2010-06-21/api.asmx";
my $server= SOAP::Lite
-> readable(1)
-> ns($api_types,'types')
-> ns($api_ns,'tns')
-> proxy($api_url)
-> on_action(sub { return "\"$_[1]\"" }) ;
$user = SOAP::Data->name("apiKey"=>$api_key);
$pass = SOAP::Data->name("apiPass"=>$api_password);
$iphoneClient = SOAP::Data->name("item" => \SOAP::Data->value(
SOAP::Data->name("ApplicationName" => "IPHONE3")
))->type("types:Client");
$gmailClient = SOAP::Data->name("item" => \SOAP::Data->value(
SOAP::Data->name("ApplicationName" => "GMAILNEW")
))->type("types:Client");
$ffAolClient = SOAP::Data->name("item" => \SOAP::Data->value(
SOAP::Data->name("ApplicationName" => "FFAOLONLINE")
))->type("types:Client");
my @clients = ();
push(@clients,$iphoneClient);
push(@clients,$gmailClient);
push(@clients,$ffAolClient);
$testParam = SOAP::Data->name("emailTest" => \SOAP::Data->value(
SOAP::Data->name("TestType" => 'email'),
SOAP::Data->name("Sandbox")->value('false')->type('boolean'),
SOAP::Data->name("Results" => \@clients)->type("soapenc:Array")->attr({"soapenc:arrayType","types:Client[".@clients."]"})
));
my $newTest = $server -> CreateEmailTest($user,$pass,$testParam);
print "Test created! Send an email to " . $newTest->valueof("//InboxGUID/") . "\@emailtests.com\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment