Interspire Email Marketer XML API Documentation
Introduction
- Requirements
- Submitting a Request
- Possible Requests
- Add Subscriber to a List
- Broken Response
- Check Token Works
- Delete Subscribers
- Get Custom Field Data
- Get Lists
- Get Subscribers
- Is Contact on List
The Interspire Email Marketer XML API is a remotely accessible service API to allow Interspire Email Marketer users to run many of the Interspire Email Marketer API functions using XML requests.
The Interspire Email Marketer XML API makes it possible to programmatically update and use your system without needing to physically access it. As XML is a general purpose markup language you can use it to communicate between your Java based applications to Interspire Email Marketer’s PHP application base.
For example you could set your system up to automatically update contact lists, create and send email campaigns, gather statistics and many other functions.
Requirements
To make use of the Interspire Email Marketer XML API you will need to be running PHP 5.1.2 or higher.
This document is designed to explain the purpose of these functions and to provide examples of their use.
Submitting a Request
An XML POST request with the details for the license to be generated should be sent to the ‘XML Path’ that you can find in the ‘User Accounts -> Edit User’ section of Interspire Email Marketer under the ‘User Permissions’ tab. Make sure that you have ‘Enable the XML API’ checked and saved. The XML Path will look similar to the following:
http://www.yourdomain.com/IEM/xml.php
The ‘username’ and ‘usertoken’ mentioned in the following examples can be found in this same section under the title of ‘XML Username’ and ‘XML Token’ respectively.
Possible Requests
This section will describe the different functions that can be used by the Interspire Email Marketer XML API.
Add Subscriber to a List
The XML document structure for ‘Adding a subscriber and associated custom details’ request is as follows:/
- xmlrequest (Required)
- username – The user name used to login to the Interspire Email Marketer. (Required)
- usertoken – The unique token assigned to the user account used above. (Required)
- requesttype – The name of the API file in question. (Required)
- requestmethod – The name of the function being called. (Required)
- details (Required)
- emailaddress – The email address of the contact being added. (Required)
- mailinglistid – The list that the contact is located within. (Required)
- confirmed – Sets the confirmation status of the subscriber to confirmed or not (yes or y or true or 1) (Not required, default to unconfirmed)
- format – The format of the email campaigns that this contact prefers to receive (html or h or text or t) (defaults to text)
- customfields
- item
- fieldid – The id of the custom field being added.
- value – The value to be added to this custom field.
Successful Response
Upon submission of a valid ‘add subscriber to list submission a contact will be added to the contact list and the contacts id number returned.
The format is as follows:
- response
- status – The value of the status field will be “SUCCESS” for a successful response.
- data – The contacts ID number.
Sample Request (XML)
The following code sample performs an insertion of the user ‘email@domain.com’ into the mailing list with ID ‘1’ , status set to ‘confirmed’ , format set to ‘html’ and with a custom field set to ‘John Smith’.
<xmlrequest> <username>admin</username> <usertoken>d467e49b221137215ebdab1ea4e046746de7d0ea</usertoken> <requesttype>subscribers</requesttype> <requestmethod>AddSubscriberToList</requestmethod> <details> <emailaddress>email@domain.com</emailaddress> <mailinglist>1</mailinglist> <format>html</format> <confirmed>yes</confirmed> <customfields> <item> <fieldid>1</fieldid> <value>John Smith</value> </item> </customfields> </details> </xmlrequest>
Sample Request (PHP)
The following sample code is written in PHP and makes use of PHP’s CURL functionality to insert the above XML into the application.
<?php
$xml = '<xmlrequest>
<username>admin</username>
<usertoken>d467e49b221137215ebdab1ea4e046746de7d0ea</usertoken>
<requesttype>subscribers</requesttype>
<requestmethod>AddSubscriberToList</requestmethod>
<details>
<emailaddress>email@domain.com</emailaddress>
<mailinglist>1</mailinglist>
<format>html</format>
<confirmed>yes</confirmed>
<customfields>
<item>
<fieldid>1</fieldid>
<value>John Smith</value>
</item>
</customfields>
</details>
</xmlrequest>
';
$ch = curl_init('http://www.yourdomain.com/IEM/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'Status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
echo 'Data is ', $xml_doc->data, '<br/>';
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}
?>
Broken Response
This example will demonstrate an error message that is returned when a bad request is made.Notice that the details tag in the example is not closed and no listid is sent for the function to use.
The XML document structure for this example is as follows:
- xmlrequest (Required)
- username – The user name used to login to the Interspire Email Marketer. (Required)
- usertoken – The unique token assigned to the user account used above. (Required)
- requesttype – The name of the API file in question. (Required)
- requestmethod – The name of the function being called. (Required)
- details (Required)
Unsuccessful Response
Upon submission of an erroneous response due to a missing field, or an invalid value the request will fail. A status message will be returned via XML as to why.
In this example you will be presented with the error message:
‘The XML you provided is not valid. Please check your xml document and try again.’The format is as follows:
- response
- status – The value of the status field will be “ERROR”.
- errormessage – A textual message explaining why the request failed.
Sample Request (XML)
The following code sample will attempt to post a request to the Get Lists function.
<xmlrequest> <username>admin</username> <usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken> <requesttype>lists</requesttype> <requestmethod>GetLists</requestmethod> </details> </xmlrequest>
Sample Request (PHP)
The following sample code is written in PHP and makes use of PHP’s CURL functionality to insert the above XML into the application.
<?php
$xml = '<xmlrequest>
<username>admin</username>
<usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken>
<requesttype>lists</requesttype>
<requestmethod>GetLists</requestmethod>
</details>
</xmlrequest>';
$ch = curl_init('http://www.yourdomain.com/IEM/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
print_r($result);
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}?>
Check Token Works
This example will check to make sure that the token that you are using is a valid token.
Notice that the details tag in the example is still included even though there are no details needed.
- xmlrequest (Required)
- username – The user name used to login to the Interspire Email Marketer. (Required)
- usertoken – The unique token assigned to the user account used above. (Required)
- requesttype – The name of the API file in question. (Required)
- requestmethod – The name of the function being called. (Required)
- details (Required)
Successful Response
Upon submission of a valid ‘check token’ request the XML API will return true.
The format is as follows:
- response
- status – The value of the status field will be “SUCCESS” for a successful response.
- data – This will return ‘1’ for a successful authorization.
Unsuccessful Response
Upon submission of an erroneous response due to a missing field, or an invalid value, the Check Token will fail. A status message will be returned via XML as to why.
In this example you will be presented with the error message:
‘Invalid details’The format is as follows:
- response
- status – The value of the status field will be “ERROR”.
- errormessage – A textual message explaining why the request failed.
Sample Request (XML)
The following code sample performs an authorization check on the usertoken to make sure that it is a valid token.
<xmlrequest> <username>admin</username> <usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken> <requesttype>authentication</requesttype> <requestmethod>xmlapitest</requestmethod> <details> </details> </xmlrequest>
Sample Request (PHP)
The following sample code is written in PHP and makes use of PHP’s CURL functionality to insert the above XML into the application.
<?php
$xml = '<xmlrequest>
<username>admin</username>
<usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken>
<requesttype>authentication</requesttype>
<requestmethod>xmlapitest</requestmethod>
<details>
</details>
</xmlrequest>';
$ch = curl_init('http://www.yourdomain.com/Interspire Email Marketer/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
print_r($result);
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}
?>
Delete Subscriber
This example will delete a contact from your contact list.
- xmlrequest (Required)
- username – The user name used to login to the Interspire Email Marketer. (Required)
- usertoken – The unique token assigned to the user account used above. (Required)
- requesttype – The name of the API file in question. (Required)
- requestmethod – The name of the function being called. (Required)
- details (Required)
- list – The ID of the Contact List that you are wishing to search (Required)
- emailaddress – The email address of the contact that you are attempting to locate (Required)
Successful Response
Upon submission of a valid ‘delete subscriber’ request the XML API will return a status of successful.
The format is as follows:
- response
- status – The value of the status field will be “SUCCESS” for a successful response.
- data
- item - the count of subscribers removed correctly.
Unsuccessful Response
Upon submission of an erroneous response due to a missing field, or an invalid value, the Delete Subscriber will fail. A status message will be returned via XML as to why.
The format is as follows:
- response
- status – The value of the status field will be “ERROR”.
- errormessage – A textual message explaining why the request failed.
Sample Request (XML)
The following code sample will delete the email address listed from the contact list of this ID.
<xmlrequest> <username>admin</username> <usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken> <requesttype>subscribers</requesttype> <requestmethod>DeleteSubscriber</requestmethod> <details> <emailaddress>email@domain.com</emailaddress> <list>1</list> </details> </xmlrequest>
Sample Request (PHP)
The following sample code is written in PHP and makes use of PHP’s CURL functionality to insert the above XML into the application.
<?php
$xml = '<xmlrequest>
<username>admin</username>
<usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken>
<requesttype>subscribers</requesttype>
<requestmethod>DeleteSubscriber</requestmethod>
<details>
<emailaddress>email@domain.com</emailaddress>
<list>1</list>
</details>
</xmlrequest>';
$ch = curl_init('http://www.yourdomain.com/IEM/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
print_r($result);
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}
?>
Get Custom Field Data
The XML document structure for retrieving a contact lists custom field data is as follows:
- xmlrequest (Required)
- username – The user name used to login to the Interspire Email Marketer. (Required)
- usertoken – The unique token assigned to the user account used above. (Required)
- requesttype – The name of the API file in question. (Required)
- equestmethod – The name of the function being called. (Required)
- details (Required)
- listids –The ID’s of the contact list that the custom field data is being requested. (Required)
Successful Response
Upon submission of a valid ‘Get Custom Field Data’ submission the custom field data found will be returned in formatted XML.
The format is as follows:
- response
- status – The value of the status field will be “SUCCESS” for a successful response.
- data
- item
- fieldid – The custom fields ID number.
- name – The name of the custom field.
- fieldtype – the type of field (text, number etc.).
- defaultvalue – If you set a default value it will appear here.
- required – If this field is required to be filled in (1 or 0).
- fieldsettings – Serialized version of the custom fields settings
Unsuccessful Response
Upon submission of an erroneous response due to a missing field, or an invalid value the Get Custom Filed Data will fail. A status message will be returned via XML as to why.
The format is as follows:
- response
- status – The value of the status field will be “ERROR”.
- errormessage – A textual message explaining why the request failed.
Sample Request (XML)
The following code sample will draw any information found on the custom fields for the list with the ID of ‘1’.
<xmlrequest> <username>admin</username> <usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken> <requesttype>lists</requesttype> <requestmethod>GetCustomFields</requestmethod> <details> <listids> 1 </listids> </details> </xmlrequest>
Sample Request (PHP)
The following sample code is written in PHP and makes use of PHP’s CURL functionality to insert the above XML into the application.
<?php
$xml = '<xmlrequest>
<username>admin</username>
<usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken>
<requesttype>lists</requesttype>
<requestmethod>GetCustomFields</requestmethod>
<details>
<listids>
1
</listids>
</details>
</xmlrequest>
';
$ch = curl_init('http://www.yourdomain.com/IEM/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
print_r($result);
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}
?>
Get Lists
This example will retrieve a list of all the Contact Lists that are located in Interspire Email Marketer and return formatted XML with the data found.
Notice that the details tag in the example is still included even though there are no details needed.- xmlrequest (Required)
- username – The user name used to login to the Interspire Email Marketer. (Required)
- usertoken – The unique token assigned to the user account used above. (Required)
- requesttype – The name of the API file in question. (Required)
- requestmethod – The name of the function being called. (Required)
- details (Required)
Successful Response
Upon submission of a valid ‘get lists’ request the XML API will return any data found on the Interspire Email Marketer Contact Lists will be returned in formatted XML.
The format is as follows:
- response
- status – The value of the status field will be “SUCCESS” for a successful response.
- data
- item
- listid – The id of the list.
- name – The name of the list.
- subscribecount – A count of how many subscribed contacts.
- unsubscribecount – A count of how many unsubscribed contacts.
- autorespondercount – A count of how many autoresponders are linked to the Contact List.
Unsuccessful Response
Upon submission of an erroneous response due to a missing field, or an invalid value, the Get Lists will fail. A status message will be returned via XML as to why.
In this example you will be presented with the error message:
‘Invalid details’The format is as follows:
- response
- status – The value of the status field will be “ERROR”.
- errormessage – A textual message explaining why the request failed.
Sample Request (XML)
The following code sample performs a request to return all the Contact Lists located within Interspire Email Marketer.
<xmlrequest> <username>admin</username> <usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken> <requesttype>user</requesttype> <requestmethod>GetLists</requestmethod> <details> </details> </xmlrequest>
Sample Request (PHP)
The following sample code is written in PHP and makes use of PHP’s CURL functionality to insert the above XML into the application.
<?php
$xml = '<xmlrequest>
<username>admin</username>
<usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken>
<requesttype>user</requesttype>
<requestmethod>GetLists</requestmethod>
<details>
</details>
</xmlrequest>';
$ch = curl_init('http://www.yourdomain.com/IEM/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
print_r($result);
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}
?>
Get Subscribers
This example will retrieve a count of the amount of Contacts on the list in question as well as a list of all the Contacts that are located in that list and return formatted XML with the data found.
- xmlrequest (Required)
- username – The user name used to login to the Interspire Email Marketer. (Required)
- usertoken – The unique token assigned to the user account used above. (Required)
- requesttype – The name of the API file in question. (Required)
- requestmethod – The name of the function being called. (Required)
- details (Required)
- searchinfo
- List – The ID of the Contact List that you are wishing to search (Required)
- Email – The email address of the contact that you are attempting to locate (Required)
Successful Response
Upon submission of a valid ‘get subscribers’ request the XML API will return a count of the amount of Contacts on the list in question along with a list of those contact email addresses in formatted XML.
The format is as follows:
- response
- status – The value of the status field will be “SUCCESS” for a successful response.
- data
- count – A count of the amount of subscribers.
- subscriberlist – A list of the subscribers email addresses.
Unsuccessful Response
Upon submission of an erroneous response due to a missing field, or an invalid value, the Get Subscribers will fail. A status message will be returned via XML as to why.
The format is as follows:
- response
- status – The value of the status field will be “ERROR”.
- errormessage – A textual message explaining why the request failed.
Sample Request (XML)
The following code sample performs a check on the Contact List with ID ‘1’ for all email addresses that contain the information ‘@yourdomain.com’.
<xmlrequest> <username>admin</username> <usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken> <requesttype>subscribers</requesttype> <requestmethod>GetSubscribers</requestmethod> <details> <searchinfo> <List>1</List> <Email>@yourdomain.com</Email> </searchinfo> </details> </xmlrequest>
Sample Request (PHP)
The following sample code is written in PHP and makes use of PHP’s CURL functionality to insert the above XML into the application.
<?php
$xml = '<xmlrequest>
<username>admin</username>
<usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken>
<requesttype>subscribers</requesttype>
<requestmethod>GetSubscribers</requestmethod>
<details>
<searchinfo>
<List>1</List>
<Email>@yourdomain.com</Email>
</searchinfo>
</details>
</xmlrequest>';
$ch = curl_init('http://www.yourdomain.com/IEM/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
print_r($result);
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}
?>
Is Contact on List
This example will check to see if a particular Contact is located on a particular Contact List.
- xmlrequest (Required)
- username – The user name used to login to the Interspire Email Marketer. (Required)
- usertoken – The unique token assigned to the user account used above. (Required)
- requesttype – The name of the API file in question. (Required)
- requestmethod – The name of the function being called. (Required)
- details (Required)
- Email – The email address of the Contact you are searching for (Required)
- List – The ID of the Contact List you are wanting to search (Required)
Successful Response
Upon submission of a valid ‘is contact on list’ request the XML API will return true if it locates the contact and will return nothing if not.
The format is as follows:
- response
- status – The value of the status field will be “SUCCESS” for a successful response.
- data – Will return ‘1’ if contact is located.
Unsuccessful Response
Upon submission of an erroneous response due to a missing field, or an invalid value, the Is Contact on List will fail. A status message will be returned via XML as to why.
The format is as follows:
- response
- status – The value of the status field will be “ERROR”.
- errormessage – A textual message explaining why the request failed.
Sample Request (XML)
The following code sample performs a check on a contact list to see if a particular contact is listed on it.
<xmlrequest>
<username>admin</username>
<usertoken>78701d1ba2588ea1991f44299b814129658c6947</usertoken>
<requesttype>subscribers</requesttype>
<requestmethod>IsSubscriberOnList</requestmethod>
<details>
<Email>email@yourdomain.com</Email>
<List>1</List>
</details>
</xmlrequest>
Sample Request (PHP)
The following sample code is written in PHP and makes use of PHP’s CURL functionality to insert the above XML into the application.
<?php
$xml = ' <requesttype>subscribers</requesttype>
<requestmethod>IsSubscriberOnList</requestmethod>
<details>
<Email>email@yourdomain.com</Email>
<List>1</List>
</details>
</xmlrequest>';
$ch = curl_init('http://www.yourdomain.com/IEM/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
print_r($result);
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}
?>
If you have any questions or problems regarding the Interspire Email Marketer API please leave a comment below or click here to submit a ticket through our client area.
15 Responses to "Interspire Email Marketer XML API Documentation" 
|
said this on 17 Jul 2008 6:09:21 PM CST
Firstly, wouldnt it be far more elegant and practical to use XML-RPC rather than pure XML? almost all major languages and CMS systems support XML-RPC so it would have seemed a far more logical choice.
Secondly is there any chance of seeing a roadmap of proposed APIs. Out of frustration we have built an API for the old SendStudio product that does all of above as well as schedule jobs and much more. We are struggling to decide if to keep working on this or switch over to the official API but with no information on the future of it, its very hard to know what to do. |
|
said this on 21 Jul 2008 7:57:53 PM CST
Hi Tom,
The XML API is only in the initial stages of development and will grow in functionality as the needs arise and as time goes on. It's using REST rather than XML-RPC or SOAP as it's easier/quicker to get started. You can use the normal API that is within SendStudio and Email Marketer to perform all the tasks that the application is capable of. If you need any help with the API please open a support ticket and we can send you some information. |
|
said this on 18 Jul 2008 2:35:28 AM CST
Here some developer hints:
Unfortunatly these seem to be the only supported operations. If you call some other function out of a class, you may get non-sense returns (like empty "data" node). Pretty bad if someone would like to build up a connector between two systems like a onlineshop and the email marketer. But obviously it works only fine if no sophisticated functions are needed. May someone find this useful: If you get a XML document back and want to transform that in a nicely and well formed Array tree use this class: class XMLparserSimpleXML { function parse($data) { $data = ltrim($data); $xml = simplexml_load_string($data); if($xml !== false) { // now convert $xml obj into a nice array structure return $this->buildArray($xml); } return false; } function buildArray($xml, $rec=0) { $data = trim((string)$xml); if($data == "") { $data = array(); foreach($xml->children() as $child) { $data[$child->getName()] = $this->buildArray($child, $rec+1); } } if($rec > 0) { return $data; } else { return array($xml->getName() => $data); } } } Now you get a nicely formed Array structure like: Array( "response" = Array( "status" => "SUCCESS" "data" => Array ( ..... ) ) ) I would really appreciate if the XML API could hold more features than just these few basic commands as remote webservices are really conveniant for scalable distributed and highly flexible systems. |
|
said this on 21 Jul 2008 7:43:47 PM CST
Hi D.P.
Thank you for your suggestion. We are looking to add more functionality to the XML API as we progress. If you have any suggestions as to functionality for this please don't hesitate to open a support ticket with your questions and comments and we will do our best to help you out. |
|
said this on 16 Sep 2008 7:19:28 PM CST
It should be noted that the new XML API *is* actually quite a bit more flexible than this document lets on. As noted around line 373 in xml.php, the requesttype and requestmethod child nodes of the request element hold values that correspond to the file name and method within the admin/functions/api directory. For example, you can access the Subscribers_API::IsUnSubscriber() to check if particular email address is listed as an unsubscriber to a specified list. Do it like this:
<?xml version="1.0"?> <xmlrequest> <username>cesystem</username> <usertoken>abc123abc123abc123abc123abc123abc123abc123abc123</usertoken> <requesttype>subscribers</requesttype> <requestmethod>IsUnSubscriber</requestmethod> <details> <emailaddress>example@example.com</emailaddress> <listId>4</listId> </details> </xmlrequest> <?xml version="1.0" encoding="ISO-8859-1" ?> <response> <status>SUCCESS</status> <data>74 </data> </response> In this case, the response includes the numeric subscriber ID, so the supplied email address *is* in the list as an unsubscriber. Some responses will include the relevant data in <item> elements. Also, the examples above use simple XML strings, but of course it will be easier to build your requests using something like SimpleXMLElement. |
|
said this on 17 Feb 2009 6:55:16 PM CST
Yes this is correct.
|
|
said this on 23 Jul 2009 7:58:19 AM CST
Seems to be a bug with the IsSubscriberOnList in IEM 5.5...
whatever email i specify, it returns me SUCCESS everytime... which is a bug ! Going to fix it ? |
|
said this on 27 Jul 2009 1:12:31 AM CST
The XML API in this case will return an empty data.
The "SUCCESS" indicate that you have successfully made a request to the API The API can return the following string in it's data: - Nothing (if subscriber is not in the list) - A number -- the subscriberid (this is the default) - An XML -- it will contains listid and subscriberid element So please check the DATA element instead of the STATUS element. |
|
said this on 25 Jul 2009 12:20:50 AM CST
I wonder if there's API that can be use to wrapped email marketer within a CMS. so if i have client, they don't have to use two seperate login page...
|
|
said this on 27 Jul 2009 1:03:47 AM CST
Try this (put it in admin directory) ... I'm not sure if it works (since I haven't test them out yet):
<?php define('IEM_NO_CONTR OLLER', true); require_once(dirname(__FI LE__) . '/index.php'); IEM::sessionLoginWithID(& lt;USERID>); // After this, you are already logged in, so // you are free to re-direct user to IEM IEM::redirectTo('ind ex'); exit(); ?> Also please note that the above code will not work in future use. It will only work for IEM 5.7.x ... |
|
said this on 30 Jul 2009 5:59:17 AM CST
Hendri,
Why will this code not work in the future? I am using the php API with IEM 5.7.x. Will it also not work in the future? // Make sure that the IEM controller does NOT redirect request. if (!defined('IEM_NO_CO NTROLLER')) { define('IEM_NO_CO NTROLLER', true); } /** * Require base sendstudio functionality. This connects to the database, sets up our base paths and so on. */ require_once dirname(__FILE__) . '/admin/index.php 39;; /** * This file lets us get api's, load language files and parse templates. */ require_once(SENDSTUDIO _FUNCTION_DIRECTORY . '/sendstudio_functio ns.php'); $this->sendstudio_fu nctions = new Sendstudio_Functions(); $this->subscriberapi = $this->sendstudio_func tions->GetApi('Su bscribers'); Thanks, Jesse |
|
said this on 30 Jul 2009 6:30:49 PM CST
Hi Jesse this particular code:
IEM::sessionLoginWithID(& lt;USERID>); Will no longer be used in IEM 5.8, but if there are a lot of people utilizing the code, we might keep the function as an interface. (It's just a simple method name change). The new method will be (this is for *planned* IEM 5.8 or above): IEM::userLogin(<USERID >) The code that you sent above will still be working correctly. |
|
said this on 27 Jul 2009 12:51:00 AM CST
@Max Schwanekamp
You must use the correct ordering with many of these or they will fail. The code uses item[0], item[1], etc as the parameters rather than taking the time to map the keyed XML values into the function parameters. |
|
said this on 05 Aug 2009 10:37:21 PM CST
Hello, I am writting a Flex application and trying to post to the XML API to insert a new user. I come from a ColdFusion background and one thing that is not clear to be looking at the PHP examples, is what POST formfield should the XML data be embeded in? Or am I missing something? As it stands now I keep getting the following responce back from the server: the XML you provided is not valid. Please check your XML document and try again. However the XML is copied right from your example and appears to be in good form. Thanks
|
|
said this on 05 Aug 2009 11:40:50 PM CST
Found the answer to my last question about how the data needs to be sent in a Flex application,
The key was is contentType="application/xml" as in: <mx:HTTPService id="AddSubscriberToList" method="POST" resultFormat="text" contentType="application/xml" useProxy="false" url="http://somedomain.com/xml.php" result="AddSubscriberResult(event)"/> |

Author/Admin)