> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.icommkt.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# WDSL guide parts generation and shipments

This module includes all the services required for the creation of Parts and/or Shipments.

# Create Part

Allows you to generate a new Newsletter (Part) in the system.

### Petition

###### URL:

| http://dominioplataforma.icommarketing.com/Newsletters.asmx?WSDL

*platformdomain must be replaced by the URL of the instance


###### WebService:

| CreateHTML


### Request Parameters

| - **ApiKey**: Key corresponding to the instance (Obtain from the instance configuration module)
| - **UserName**: Platform access user name
| - **Campaign**: Name of the campaign in which to generate the piece
| - **NewsletterName**: Name of the piece to generate
| - **PlainText**: Plain text of the piece
| - **Content**: HTML content of the piece


###### Request Response -> Results

**Object with the following structure (JSON) ->**
||| * StatusCode: Operation Result Code
||| * Message: Text of the result of the operation
||| * MessageDetail: Details of the error message when it occurs
||| * Data: Additional information

### List of Response Codes

||| **(1) Newsletter Created**: The Newsletter has been created and approved satisfactorily.
||| **(501) Template not found**: The HTML template was not found in the instance.
||| **(502) User Not Found**: The UserName sent could not be found among the users of the instance.
||| **(503) Campaign Not Found**: The sent campaign does not exist.
||| **(504) Campaign is not valid for this User**: The sent user does not have access to the requested campaign.
||| **(505) Content or Plain Text are empty**: The content or plain text of the request is empty.
||| **(550) General Error**: An error has occurred while generating the part, view the Message and MessageDetail fields for more information.
||| **(512) Invalid SocialNetworks Field Value: The content of the SocialNetworks field is invalid. You must send a comma-delimited string that contains the IDs of the social networks that you want to include in the communication.

### PHP Example

```php
require_once('lib/nusoap.php');
date_default_timezone_set('UTC');
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';
$client = new nusoap_client('http://domain.icommarketing.com/Newsletters.asmx?WSDL','wsdl','','','','');
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
exit();
}
$client->setUseCurl($useCURL);
$html = 'HTML';
$html = utf8_decode($html);
$param = Array(
"ApiKey"=>"API_KEY",
"UserName"=>"UserName",
"Campaign"=>"Campaign Name",
"NewsletterName"=>"Newsletter Name",
"Content"=>$html,
"PlainText"=>"test"
);
$result = $client->call('CreateHTML',$param,",",false,true);
// Check for a fault
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>';
$auxresponse = json_decode($client->responseData);
echo '<pre>StatusCode' . $auxresponse->{'StatusCode'} . '</pre>';
echo '<pre>Message' . $auxresponse->{'Message'} . '</pre>';
echo '<pre>MessageDetail' . $auxresponse->{'MessageDetail'} . '</pre>';
echo '<pre>Data' . $auxresponse->{'Data'} . '</pre>'; }

}

```

# Create Shipment

It allows triggering a new delivery from the instance, detailing the content to be sent and the audience to which it will be addressed.

### Petition

###### URL
| http://dominioplataforma.icommarketing.com/Deliveries.asmx?WSDL
*platformdomain must be replaced by the URL of the instance

###### WebService
| CreateConfiguration

### Request Parameters

| - **ApiKey**: Key corresponding to the instance (Obtain from the instance configuration module)
| - **UserName**: Platform access user name
| - **Campaign**: Name of the campaign in which to generate the piece
| - **NewsletterName**: Name of the piece to generate
| - **PlainText**: Plain text of the piece
| - **Content**: HTML content of the piece
| - **FromMail**: Sender Email Address (must exist in the platform's address list)
| - **FromName**: Sender's Name
| - **ReplyMail**: Reply Mail Address (must exist in the platform's address list)
| - **Subject**: Mail Subject
| - **PreHeader**: Mail PreHeader (additional information to the Subject that some mail programs allow)
| - **Profiles**: Comma-separated list of the PROFILE_KEYs to be associated with the shipment (obtain the PROFILE_KEYs from the PROFILES screen on the platform).
| - **StartDate**: Date and Time of Scheduling the Shipment. The format must be YYYY-MM-DDTHH24:MI:SS.
| - **ViralMarketing**: Property to determine if you want to include the LINK so that the recipient can forward the Newsletter to a friend. Possible values: true or false.
| - **SocialNetworks**: Property to determine WHICH LINKS to share on social networks are included. This field must be a string of IDs separated by commas, according to the following reference:
| * ID 1: Facebook
| * ID 2: Twitter
| * ID 3: LinkedIN
| * ID 4: Google +
| * ID 5: Pinterest
| **Note**: If you do not wish to incorporate any icon to share on social networks, this field must remain EMPTY.
| - **Testing**: Property to determine if the shipment is from Testing or Real. Possible values: true or false.
| - **SendGoogleAnalyticsData**: Property to determine if the sending automatically includes the campaign identification parameters for Google Analytics. Possible values: true or false.

###### Request Response -> Results

**Object with the following structure (JSON) ->**
||| **StatusCode**: Operation Result Code
||| **Message**: Text of the result of the operation
||| **MessageDetail**: Details of the error message when it occurs
||| **Data**: Additional information

### List of Response Codes

||| **(1) Configuration Created**: The Shipping Configuration has been successfully created and approved.
||| **(501) Template not found**: The HTML template was not found in the instance.
||| **(502) User Not Found**: The UserName sent could not be found among the users of the instance.
||| **(503) Campaign Not Found**: The sent campaign does not exist.
||| **(504) Campaign is not valid for this User**: The sent user does not have access to the requested campaign.
||| **(510) Profile/s Not Found**: Any of the PROFILE_KEYs sent does not exist.
||| **(511) Selected profile/s not compatible with selected Template**: The submitted profiles are not compatible with the submitted part. The shipment will be aborted.
||| **(550) General Error**: An error has occurred while generating the part, view the Message and MessageDetail fields for more information.


### PHP Example

```php
require_once('lib/nusoap.php');
date_default_timezone_set('UTC');
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';
$client = new nusoap_client('http://domain.icommarketing.com/Deliveries.asmx?WSDL','wsdl','','','','');
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
exit();
}
$client->setUseCurl($useCURL);
$html = 'HTML';
$html = utf8_decode($html);
$param = Array(
"ApiKey"=>"API_KEY",
"UserName"=>"UserName",
"Campaign"=>"Campaign Name",
"NewsletterName"=>"Newsletter Name",
"Content"=>$html,
"PlainText"=>"test",
"FromMail"=>"newsletter@dominionews.com",
"FromName"=>"FromName",
"Subject"=>"Subject",
"ReplyMail"=>" newsletter-reply@dominionews.com ",
"Profiles"=>"PROFILE_KEY1, PROFILE_KEY1",
"StartDate"=>"2014-06-06T17:30:00.000",
"ViralMarketing"=>"true",
"SocialNetworks"=>"1,2,3,4,5",
"Testing"=>"false",
"PreHeader"=>"PreHeader",
"SendGoogleAnalyticsData"=>"true"
);
$result = $client->call('CreateConfiguration',$param,",",false,true);
// Check for a fault
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>';
$auxresponse = json_decode($client->responseData);
echo '<pre>StatusCode' . $auxresponse->{'StatusCode'} . '</pre>';
echo '<pre>Message' . $auxresponse->{'Message'} . '</pre>';
echo '<pre>MessageDetail' . $auxresponse->{'MessageDetail'} . '</pre>';
echo '<pre>Data' . $auxresponse->{'Data'} . '</pre>'; }

}


```

# Create Submission w/Pre-existing News
Allows you to trigger a new shipment from the instance, using a previously created part.

### Petition

###### URL

| http://dominioplataforma.icommarketing.com/Deliveries.asmx?WSDL
*platformdomain must be replaced by the URL of the instance

###### WebService

| CreateConfigurationWithExistingNews

### Request Parameters

| - **ApiKey**: Key corresponding to the instance (Obtain from the instance configuration module)
| - **UserName**: Platform access user name
| - **Campaign**: Name of the campaign in which to generate the piece
| - **NewsletterName**: Name of the piece to generate
| - **FromMail**: Sender Email Address (must exist in the platform's address list)
| - **FromName**: Sender's Name
| - **ReplyMail**: Reply Mail Address (must exist in the platform's address list)
| - **Subject**: Mail Subject
| - **PreHeader**: Mail PreHeader (additional information to the Subject that some mail programs allow)
| - **Profiles**: Comma-separated list of the PROFILE_KEYs to be associated with the shipment (obtain the PROFILE_KEYs from the PROFILES screen on the platform).
| - **StartDate**: Date and Time of Scheduling the Shipment. The format must be YYYY-MM-DDTHH24:MI:SS.
| - **ViralMarketing**: Property to determine if you want to include the LINK so that the recipient can forward the Newsletter to a friend. Possible values: true or false.
| - **SocialNetworks**: Property to determine WHICH LINKS to share on social networks are included. This field must be a string of separate ID's
| by commas, according to the following reference:
| * ID 1: Facebook
| * ID 2: Twitter
| * ID 3: LinkedIN
| * ID 4: Google +
| * ID 5: Pinterest
| - **Note**: If you do not wish to incorporate any icon to share on social networks, this field must remain EMPTY.
| - **Testing**: Property to determine if the shipment is from Testing or Real. Possible values: true or false.
| - **SendGoogleAnalyticsData**: Property to determine if the sending automatically includes the campaign identification parameters for Google
| Analytics. Possible values: true or false.

###### Request Response -> Results

**Object with the following structure (JSON) ->**

||| **StatusCode**: Operation Result Code
||| **Message**: Text of the result of the operation
||| **MessageDetail**: Details of the error message when it occurs
||| **Data**: Additional information

### List of response codes

||| **(1) Configuration Created**: The Shipping Configuration has been successfully created and approved.
||| **(502) User Not Found**: The UserName sent could not be found among the users of the instance.
||| **(503) Campaign Not Found**: The sent campaign does not exist.
||| **(504) Campaign is not valid for this User**: The sent user does not have access to the requested campaign.
||| **(505) NewsletterName could not be found**: The newsletter requested to associate with the delivery has not been found.
||| **(510) Profile/s Not Found**: Any of the PROFILE_KEYs sent does not exist.
||| **(550) General Error**: An error has occurred while generating the part, view the Message and MessageDetail fields for more information.

### PHP Example

```php
require_once('lib/nusoap.php');
date_default_timezone_set('UTC');
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';
$client = new nusoap_client('http://domain.icommarketing.com/Deliveries.asmx?WSDL','wsdl','','','','');
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
exit();
}
$client->setUseCurl($useCURL);
$html = 'HTML';
$html = utf8_decode($html);
$param = Array(
"ApiKey"=>"API_KEY",
"UserName"=>"UserName",
"Campaign"=>"Campaign Name",
"NewsletterName"=>"Newsletter Name",
"FromMail"=>"newsletter@dominionews.com",
"FromName"=>"FromName",
"Subject"=>"Subject",
"ReplyMail"=>" newsletter-reply@dominionews.com ",
"Profiles"=>"PROFILE_KEY1, PROFILE_KEY1",
"StartDate"=>"2014-06-06T17:30:00.000",
"ViralMarketing"=>"true",
"SocialNetworks"=>"1,2,3,4,5",
"Testing"=>"false",
"PreHeader"=>"PreHeader",
"SendGoogleAnalyticsData"=>"true"
);
$result = $client->call('CreateConfigurationWithExistingNews',$param,",",false,true);
// Check for a fault
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>';
$auxresponse = json_decode($client->responseData);
echo '<pre>StatusCode' . $auxresponse->{'StatusCode'} . '</pre>';
echo '<pre>Message' . $auxresponse->{'Message'} . '</pre>';
echo '<pre>MessageDetail' . $auxresponse->{'MessageDetail'} . '</pre>';
echo '<pre>Data' . $auxresponse->{'Data'} . '</pre>'; }

}```