Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

 

Returns all the newsletters created within a list

Method parameters

  • string GetNewsletters(string accessKey, intlistID)
    • accessKey: access key obtained using the LoginLoginFromId method
    • listID: Id of the list in which the desired newsletters are contained. Lists and corresponding IDs can be obtained calling the GetLists Method

If error code=0, the message will contain the IDs of all the newsletters in the list.

...

 

Note
titleKNOWN RESTRICTION

Characters & and " are not escaped in returned response, so please avoid these characters in message subjects otherwise you will experience some problems due to an invalid returned XML

SOAP Examples

Code Block
languagehtml/xml
titleSOAP request
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ws="http://services.mailupnet.it/WS">
   <soap:Header/>
   <soap:Body>
      <ws:GetNewsletters>
          <!--Use accessKey value that is returned by LoginFromId method-->
          <ws:accessKey>HzAgwRRJaAKBtkgNWpkAuURfV4SxMm6T3HJegRuSkUivKJElNNcmSQe8nqGyoM9</ws:accessKey>
         <ws:listID>1</ws:listID>
      </ws:GetNewsletters>
   </soap:Body>
</soap:Envelope>
Code Block
languagehtml/xml
titleSOAP response
linenumberstrue
<?xml version="1.0" encoding="utf-8"?>
<GetNewslettersResult>
<errorCode>0</errorCode>
<errorDescription><<errorDescription /errorDescription>>
<list>
<listID>1</listID>
<listName>Lista nr.1<<listName>News</listName>
<newsletters>
<newsletter>
  <newsletterID>1</newsletterID>
  <subject>Sample Message (Read Me)</subject>
  <note>Review this test message for important information on how to create messages in MailUp</note>
  <creationdate>03/08/2011 12:32:31</creationdate>
</newsletter>
<newsletter>
  <newsletterID>2</newsletterID>
  <subject>Sample Message created from a Template</subject>
  <note>This message was created using one of the 400 built-in templates</note>
  <creationdate>04/08/2011 12:32:31</creationdate>
</newsletterID>
<subject>Newsletter nr.1 Aprile 2009 | Le novità del mese</subject>
<creationdate>20090402<newsletter>
<newsletter>
  <newsletterID>3</newsletterID>
  <subject>Bonnie &amp; Clyde</subject>
  <note>Bonnie &amp; Clyde</note>
  <creationdate>04/08/2011 16:36:32</creationdate>
</newsletter>
<newsletter>
  <newsletterID>4</newsletterID>
  <subject>Confirm your subscription</subject>
  <note />
  <creationdate>05/08/2011 12:32:31</creationdate>
</newsletter>
<newsletter>
  <newsletterID>1</newsletterID>
<subject>Newsletter nr.2 Maggio 2009 | Le novità del mese</subject>
<creationdate>20090505<<newsletterID>5</newsletterID>
  <subject>Sample Message created from a Template(Copy)</subject>
  <note>This message was created using one of the 400 built-in templates</note>
  <creationdate>06/08/2011 12:32:31</creationdate>
</newsletter>
<newsletter>
  <newsletterID>6</newsletterID>
  <subject>Pro+va</subject>
  <note />
  <creationdate>07/11/2011 17:13:18</creationdate>
</newsletter>
</newsletters>
</list>
</GetNewslettersResult>

Code Examples

The code examples below are provided on an "as is" basis, without any warranty of any kind. MailUp shall not be held liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or other related to the example code. Please contact us if you are interested in submitting examples for programming languages that are not already included below.

Code Block
languageruby
titleRuby
# Refer to https://mailup.atlassian.net/wiki/display/mailupapi/MailUp+RubyGem for gem information.
require 'mailup'
m = MailUp::Send.new('username', 'password')
m.get_newsletters
# => <GetNewslettersResult><errorCode>0</errorCode><errorDescription></errorDescription><list><listID>0</listID><listName></listName><newsletters></newsletters></list></GetNewslettersResult>"
Code Block
languagecsharp
titleC#
firstline1
linenumberstrue
it.mailupnet.services.MailupSend myService = new it.mailupnet.services.MailupSend();
 
... // perform login by means of LoginFromId(user, password, myConsoleID) method and obtain accessKey value
 
string s = myService.GetNewsletters(accessKey, 1); //Returns all that have been messages created within list 1
 
...//extract errorCode value from received response; 
 
if (errorCode == 0)
{
  // enter here if request was successful
  // then received response can be parsed to retrieve the messages that belong to specified list
} 
Code Block
languagephp
titlePHP
firstline1
linenumberstrue
<?php
class MailUpWsSend {
	protected $WSDLUrl = "http://services.mailupnet.it/MailupSend.asmx?WSDL";
	private $soapClient;
	private $xmlResponse;
	protected $domResult;
	function __construct() {
		$this->soapClient = new SoapClient($this->WSDLUrl,array("trace" => 1,"exceptions" => 0));
	}
	
//...
	public function getNewsletters($params) {
		try {
			$params = array_merge((array)$params, array("accessKey" => $this->accessKey));
			$this->soapClient->GetNewsletters($params);
			if ($this->readReturnCode("GetNewsletters","errorCode") != 0) 
				echo "<br /><br />Errore GetNewsletters: ". $this->readReturnCode("GetNewsletters","errorDescription");
			else $this->printLastResponse();
			
		} catch (SoapFault $soapFault) {	
				var_dump($soapFault);
		}
	}
//...
 
}
?>
<html>
<head></head>
<body>
<?php
$WsSend = new MailUpWsSend();
$WsSend->loginFromId(array("user" => "a123456","pwd" => "MyPassword","consoleId" => "123456"));
$WsSend->getNewsletters(array("listID" => "1"));
 
$WsSend->logout();
?>
</body>
</html>