Table of contents
Current Features
The schema for Topica's web services is located here (services.xsd)
All Topica messages are comprised of a topicaAction enclosed within the body of a SOAP message. The topicaAction body includes user authentication and information about the list.
For example:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<topicaAction username="your_login@your_domain.com" password="your_password"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:SchemaLocation="http://www.topica.com/services/services.xsd"
xmlns="http://www.topica.com/Dispatcher/" >
<someTopicaAction/>
</topicaAction>
</soap:Body>
</soap:Envelope>
Each request must include a valid username and password. A successful request will return success. If an error is encountered, it will be returned
to the user.
Requests are submitted to http://www.topica.com/api/Dispatcher using SOAP (HTTP Post).
Also, it is possible to import subscribers via inline and via a web url. For large amounts of
subscribers, placing the subscriber list on a web-accessible url is recommended.
Imports are of the following general form:
Below are explanations for some of the important features of the configuration:
Subscriber Export
Subscriber Export takes the form of the following. Values which must be changed are
displayed in red.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<topicaAction username="your_login@your_domain.com" password="your_password"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:SchemaLocation="http://www.topica.com/services/services.xsd"
xmlns="http://www.topica.com/Dispatcher/" >
<subscriberExport
list="your_list@app.topica.com"
column-delimiter=","
value-delimiter=";"
export-type="active"
from-date="2001-01-01"
to-date="2004-01-01"
email-to="your_email@your_domain.com"
upload-url="ftp://user:pass@your_domain.com/home/joe/your-file.zip"/>
</topicaAction>
</soap:Body>
</soap:Envelope>
The results of the action will be mailed to the address specified in the email-to field. Configuration details include:
Valid options are [active | disabled | unsubscribed | all].
Subscriber Import
Subscriber Import is analagous to the browser-based imports. Each field in the record is assigned to a database field, and flags are set for handling the import. This feature allows for a flexible configuration options.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<topicaAction username="your_login@your_domain.com" password="your_password"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:SchemaLocation="http://www.topica.com/services/services.xsd"
xmlns="http://www.topica.com/Dispatcher/" >
<subscriberImport
list="your_list@app.topica.com"
column-delimiter=","
value-delimiter=";"
duplicate="complete-overwrite"
first-row="data"
send-confirmations="false"
email-to="your_email@your_domain.com">
<mapping>
<column order="1" field="Email Address" create-if-new="false"/>
<column order="2" field="Favorite Color" create-if-new="true" data-type="multi">
<category-values convert-case="true" create-if-new="true">
<map from="y" to="Yellow"/>
<map from="yellow" to="Yellow"/>
<map from="b" to="Black"/>
</category-values>
</column>
<column order="3" field="Address 1" create-if-new="true" data-type="text"/>
<column order="4" field="Address 2" create-if-new="true" data-type="text"/>
<column order="5" field="City" create-if-new="true" data-type="text"/>
<column order="6" field="State or Province" create-if-new="false" data-type="category"/>
</mapping>
<data source="url">http://www.topica.com/services/sample_import.txt</data>
</subscriberImport>
</topicaAction>
</soap:Body>
</soap:Envelope>
In the example above, the subscriber list is downloaded from http://www.topica.com/services/sample_import.txt. The order of the fields is specified, and, in the case of "Favorite Color," the values are mapped onto other values (ie, "y" becomes "Yellow").
Acceptable values: [ complete-overwrite | replace-existing | preserve-existing | reject-duplicates ]
All of the import methods will import the entire subscriber record if the subscriber is new, however, if the subscriber already exists, the behavior differs as follows:
complete-overwrite - drops the subscriber and replace with the new record.
replace-existing - update the subscriber with the new data.
preserve-existing - keep subscriber data, only add to the record, do not overwrite.
reject-duplicates - This is the default. Do not import the subscriber if the subscriber already exists.
Acceptable values: [ true | false | force-restricted-pending | confirm-restricted-only ]
true - Confirm all subscribers.
false - Confirm no subscribers, if possible, otherwise, default to "force-restricted-pending."
force-restricted-pending - Do not confirm subscribers. Domains that require confirmation will be set to pending.
confirm-restricted-only - Only send confirmations to domains that require them.
Subscriber Unsubscribe
Subscriber Unsubscribe is a basic message structure. It takes a list of subscribers which can be included inline, or downloaded from a URL, and unsubscribes them, mailing the results back to the email specified. Values which must be changed are
displayed in red.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<topicaAction username="your_login@your_domain.com" password="your_password"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:SchemaLocation="http://www.topica.com/services/services.xsd"
xmlns="http://www.topica.com/Dispatcher/" >
<subscriberUnsubscribe
list="your_list@app.topica.com"
email-to="your_email@your_domain.com">
<data source="url">http://www.topica.com/services/sample_unsubscribe.txt</data>
</subscriberUnsubscribe>
</topicaAction>
</soap:Body>
</soap:Envelope>
The results of the action will be mailed to the address specified in the email-to field. Configuration details include:
Acceptable values: [ inline | uri ]
uri means that data should be loaded via an HTTP fetch from a given URI (which could be http://, ftp://, etc)
Sample Code
The following are perl scripts demonstrating simple requests.