Docmail Hybrid Mail API v2 Guide 30/03/2011
Docmail Hybrid Mail API v2 Guide 30/03/2011
Version 2.0
22nd March 2011
Overview..................................................................................................................... 5
Referencing the web service ............................................................................... 5
Set up a Docmail account to use the web service ............................................... 5
Details of the service .................................................................................................. 6
Data formats ........................................................................................................... 7
Return Formats.................................................................................................... 7
Template File Formats ......................................................................................... 7
Mailing List File Formats ...................................................................................... 7
1 - Creating Mailings ............................................................................................... 8
Create File Mailing............................................................................................... 8
Create Mailing ..................................................................................................... 9
Add Mailing Filter ............................................................................................... 10
Add Delivery Address ........................................................................................ 10
Update Mailing Options ..................................................................................... 11
2 - Mail Packs ....................................................................................................... 12
Add Template File ............................................................................................. 12
Add Template Background File ......................................................................... 13
Add Template From Library ............................................................................... 14
Add Template From Order ................................................................................. 14
Add Mail Pack From Library .............................................................................. 15
Add Mail Pack From Order ................................................................................ 15
Add Designer Template ..................................................................................... 16
Add Designer Image .......................................................................................... 17
Add Designer Stored Image .............................................................................. 17
Add Designer Text ............................................................................................. 18
Set Mail Pack Variable Value ............................................................................ 19
Set Template Variable Value ............................................................................. 19
Get Template Image .......................................................................................... 20
Add Template Use Rule .................................................................................... 20
Add Template Background Rule ........................................................................ 20
3 - Mailing Lists ..................................................................................................... 21
Add Mailing List File .......................................................................................... 21
Add Mailing List String ....................................................................................... 22
Add Mailing List From Library ............................................................................ 22
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 2
Add Mailing List From Order .............................................................................. 23
Add Address ...................................................................................................... 23
Add Self ............................................................................................................. 24
Auto Correct Addresses .................................................................................... 25
Set Mailing List Proof Option ............................................................................. 25
4 - Delete and Cancel ........................................................................................... 26
Delete Template ................................................................................................ 26
Delete Mail Pack................................................................................................ 26
Delete Mailing List ............................................................................................. 27
Delete Mailing .................................................................................................... 27
Cancel Mailing ................................................................................................... 27
5 - Payment ........................................................................................................... 28
Process Mailing ................................................................................................. 28
Get Mailing Details ............................................................................................ 29
Get Status ......................................................................................................... 31
Get Proof File .................................................................................................... 32
Get Proof Image ................................................................................................ 32
Get Balance ....................................................................................................... 33
Get Mailing GUID From Order Ref .................................................................... 33
User Approve Mailing ........................................................................................ 33
Cancel Mailing Approval .................................................................................... 34
6 - Lists ................................................................................................................. 35
List Formats ....................................................................................................... 35
List Mailings....................................................................................................... 35
List Mailings Page Count ................................................................................... 37
List Library Templates ....................................................................................... 38
List Library Templates Page Count ................................................................... 39
List Library Backgrounds ................................................................................... 40
List Library Backgrounds Page Count ............................................................... 41
List Library Mail Packs....................................................................................... 42
List Library Mail Packs Page Count ................................................................... 43
List Library Mailing Lists .................................................................................... 44
List Library Mailing Lists Page Count ................................................................ 44
List Mailing Filter Categories ............................................................................. 45
List Mailing Filters For Category ........................................................................ 45
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 3
List Mailing Variable Values .............................................................................. 46
List Product Types ............................................................................................. 46
List Document Types ......................................................................................... 47
List Template Variables ..................................................................................... 48
7 - Zip Data ........................................................................................................... 49
Get Mail Pack Zip .............................................................................................. 49
Get Mailing List Zip ............................................................................................ 49
8 - Account and User Administration ..................................................................... 50
Create Account .................................................................................................. 50
Add User ........................................................................................................... 51
Add User Organisation Structure Link ............................................................... 52
Add User Sign-up Data...................................................................................... 52
9 - Mailing List Address Counts and Price Estimates ............................................ 53
Add Mailing List File For Address Count ........................................................... 53
Add Mailing List String For Address Count ........................................................ 54
Poll Mailing List For Address Count................................................................... 55
Get Mailing Price Estimate ................................................................................ 56
Get Price Estimate............................................................................................. 57
10 - Adding Library Data ....................................................................................... 58
Add Mailing List File To Library ......................................................................... 58
Add Mailing List String To Library ...................................................................... 59
Add Template File To Library ............................................................................ 60
Add Background File To Library ........................................................................ 61
Add Mail Pack To Library .................................................................................. 62
Add Template To Library Mail Pack................................................................... 62
11 - Extended Calls ............................................................................................... 63
Extended Call .................................................................................................... 63
Extended Call Definition .................................................................................... 63
Example code ........................................................................................................... 65
Adding a service reference or web reference in .NET ....................................... 65
Service Reference size limit .............................................................................. 65
Service Reference timeout limit ......................................................................... 65
VB .NET code Samples ..................................................................................... 66
Glossary of terms ..................................................................................................... 69
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 4
Overview
The following help is for the Docmail web service version 2.0. The existing version
1.1 web service and simple API are still supported, but we recommend that version
2.0 is used for all new development.
If you are not familiar with the Docmail system then please refer to the “
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 5
Glossary of terms” at the back of the help guide, or read the Docmail help guide on
the website to familiarise yourselves with Docmail terminology.
The Docmail API is a SOAP-based web service and in order to connect you will need
the WSDL (service description) page URL, these can be found at:
For testing:
https://www.cfhdocmail.com/TestAPI2/DMWS.asmx
The testing API has an associated test website, please use this website to set-up a
test account:
https://www.cfhdocmail.com/Test
Note: Please reference the live XML schemas when using the test API.
For live:
https://www.cfhdocmail.com/LiveAPI2/DMWS.asmx
For live API use the main Docmail website, please use this website to set-up a live
account:
https://www.cfhdocmail.com/Live
Referencing the web service” above for the relevant URL) either create an account or
login to an existing account. During the sign-up process you can select whether the
main account user can access the web service, this option can be changed at any
time in the website from the Admin My Login Details screen.
To add an additional user for web service access, go to Admin Additional users
and click the “Add new user” link. Enter a login name and password for the web
service user, ensuring that the “Can use web service” is checked, along with the
other required permissions.
Note: In order to use the “SendToSelf” option when placing a mailing you must login
to the Docmail website with the new user and enter the address details.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 6
Details of the service
The operations available from the web service will be referenced under the following
sections to help guide you through the order of use when creating a mailing and then
to look at additional advanced calls available:
1 - Creating Mailing
2 - Mail Packs
3 - Mailing Lists
5 - Payment
6 - Lists
7 - Zip Data
11 - Extended Calls
If failure is returned from a call that returns a byte array, then a UTF 8 encoded
failure string of one of the Return Formats will be returned.
If the call has no return value specified then a successful call will include a “Success”
flag with the value True; otherwise a successful call will return the data specified.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 7
Data formats
Return Formats
Text (default)
The return string is in the format of a new line for each item, with the header
followed by a colon and a space then the data. Example result text data:
MailingGUID: 00000000-0000-0000-0000-000000000000
XML
The return string will be formatted in XML. The definition for the XML result
can be found at https://www.cfhdocmail.com/LiveAPI2/Result.xsd. Example
result XML data:
If Word documents are encrypted or contain protected area passwords then the
relevant passwords must be supplied to remove the protection whilst processing.
The reference calls in this section can be used to create a mailing and set the mailing
options within Docmail.
The first step in creating a mailing is to call Create File Mailing or Create Mailing.
These calls both return one or more Mailing GUIDs that can be used for all future
calls relating to the mailing.
This call allows one or more mailings to be created from a zip file without the need for
any further calls. To control the mailings an XML configuration file needs to be
included within the zip file that conforms to the Docmail Web Service schema that
can be found at https://www.cfhdocmail.com/LiveAPI2/DMWS.xsd. An example xml
file can be found at https://www.cfhdocmail.com/LiveAPI2/DMWSExample.xml.
The complex type names defined within the schema match the name of calls within
the web service. Therefore for further help on the parameters of each type you
should refer the relevant web service call, for example the “createMailing” type has
parameters that match the Create Mailing web service call.
If a configuration XML file is not included within the zip file then the call will create an
auto submit A4 letter mailing using the account default mailing options. Without an
XML file all document format files within the zip would be added as templates and all
supported mailing list file formats would be assumed to be mailing list files for import.
The create file mailing call returns “MailingGUID 1”, “MailingGUID 2” etc for each
mailing in the XML file. The Mailing GUIDs can be used to check the status or to
perform other actions on the mailing. If a mailing fails to be submitted successfully
an error will be returned, along with any Mailing GUIDs that have successfully been
saved for processing. The error message will also include the “Error processing
mailing name” to identify the mailing name that failed. Please note that if the zip
contains multiple mailings, then once a mailing fails to be created all subsequent
mailings within the zip file will not have been created. Once all mailings are created
any errors in processing will only affect the single mailing.
Parameter Data Type / Description
Max length
Username String(30) Docmail user name.
Password String(30) Password for the user
ZipFile Byte Array A zip archive file containing all the other files that
require processing. An XML file should be included
that references how to use the other files within the zip
archive.
ReturnFormat String Specify as “Text” or “XML” see Return Formats.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 9
Create Mailing
This call adds a new mailing to the account using the parameters defined. This call
returns a mailing GUID that can be used to add data to the mailing.
Parameter Data Type / Description
Max length
Username String(30) Docmail user name.
Password String (30) Password for the user.
CustomerApplication String(50) An optional identification of the software creating the
mailing.
ProductType String Specify as “A4Letter”, “BusinessCard”, “GreetingCard”,
or “Postcard”. If not supplied then defaults as specified
in default mailing options. The product type must be
available for your account, for example business cards
are currently only available for corporate accounts,
please see the Docmail website to confirm the
products available.
MailingName String(50) An optional name for the mailing.
MailingDescription String(50) An optional description for the mailing.
IsMono Boolean Control if the mailing is printed in black and white (true)
or colour (false).
IsDuplex Boolean Control if the mailing is double sided (true) or single
sided (false).
DeliveryType String Specify as “First”, “Standard” or “Courier”. If not
supplied then defaults as specified in default mailing
options.
CourierDeliveryToSelf Boolean If the delivery type is courier then specify whether to
despatch the order to the user’s address.
DespatchASAP Boolean Whether to despatch the mailing as soon as possible.
If set then the despatch date is ignored.
DespatchDate Date The date to despatch the order on. The Despatch
ASAP must be set to false.
AddressNamePrefix String(30) A prefix for the address name, e.g. “To the parent of”.
AddressNameFormat String Specify as “Full Name”, “Firstname Surname”, “Title
Initial Surname”, “Title Surname”, or “Title Firstname
Surname”. If not supplied then defaults as specified in
default mailing options.
DiscountCode String(20) A discount code to apply to the mailing. If not supplied
then defaults as specified in default mailing options.
MinEnvelopeSize String Specify as “C4”, “C5” or leave blank. If not supplied
then defaults as specified in default mailing options.
ReturnFormat String Specify as “Text” or “XML” see Return Formats.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 10
Add Mailing Filter
This call is for corporate users only and adds a mailing filter to the mailing.
This call is for courier despatch orders only and adds a delivery address to the order.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 11
Update Mailing Options
This call updates the mailing options for a given mailing GUID.
Parameter Data Type / Description
Max length
Username String(30) Docmail user name.
Password String (30) Password for the user.
MailingGUID GUID The mailing GUID returned from creating the mailing.
MailingName String(50) An optional name for the mailing.
MailingDescription String(50) An optional description for the mailing.
IsMono Boolean Control if the mailing is printed in black and white (true)
or colour (false).
IsDuplex Boolean Control if the mailing is double sided (true) or single
sided (false).
DeliveryType String Specify as “First”, “Standard” or “Courier”. If not
supplied then defaults as specified in default mailing
options.
DespatchASAP Boolean Whether to despatch the mailing as soon as possible.
If set then the despatch date is ignored.
DespatchDate Date The date to despatch the order on. The Despatch
ASAP must be set to false.
AddressNamePrefix String(30) A prefix for the address name, e.g. “To the parent of”.
AddressNameFormat String Specify as “Full Name”, “Firstname Surname”, “Title
Initial Surname”, “Title Surname”, or “Title Firstname
Surname”. If not supplied then defaults as specified in
default mailing options.
DiscountCode String(20) A discount code to apply to the mailing. If not supplied
then defaults as specified in default mailing options.
MinEnvelopeSize String Specify as “C4”, “C5” or leave blank. If not supplied
then defaults as specified in default mailing options.
ReturnFormat String Specify as “Text” or “XML” see Return Formats.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 12
2 - Mail Packs
The referenced calls in this section can be used to add mail pack data to a mailing.
This call adds a template document to the mailing. This call returns a template GUID
that can be used to add a background file or variable values.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 14
Add Template From Library
This call adds a template from the library. This call returns a template GUID that can
be used to add a background file or set variable values. For corporate users this call
can also be used to add inserts to a mailing, supplying the insert name as the
template name parameter.
This call adds a template from a previous order to the current mailing. This call
returns a template GUID that can be used to add a background file or set variable
values.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 15
Add Mail Pack From Library
This call adds a mail pack from the library. This call returns a mail pack GUID that
can be used to set variable values along with TemplateGUID 1, TemplateGUID 2 etc
for each template that has been added.
This call adds a mail pack from a previous order to the current mailing. This call
returns a mail pack GUID that can be used to set variable values along with
TemplateGUID 1, TemplateGUID 2 etc for each template that has been added.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 16
Add Designer Template
This call adds a designer template to the current mailing, allowing the creation of
postcards and greeting cards by uploading or selecting the parts that make up the
final template. Only one designer template can be added to a mailing.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 17
Add Designer Image
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 18
Add Designer Text
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 19
Set Mail Pack Variable Value
This call sets a variable value for all templates containing the variable in the mail
pack.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 20
Get Template Image
This call returns a byte array image preview or thumbnail. Pass the page number as
0 for the thumbnail or 1 for the large preview image.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 21
3 - Mailing Lists
The referenced calls in this section can be used to add addresses to a mailing.
If you are using a file or string to import data then it is recommended that a library
mapping is created in the Docmail website and the mapping name passed to the
calls. This will ensure the correct mapping of columns is always used for the import.
This function adds the addresses from a mailing list file to the mailing. This call
returns a Mailing List GUID that can be used for obtaining address count information.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 22
Add Mailing List String
This function adds the addresses from a formatted string to the mailing. This call
returns a Mailing List GUID that can be used for obtaining address count information.
This function adds the addresses from a library mailing list to the mailing. This call
returns a Mailing List GUID that can be used for obtaining address count information.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 23
Add Mailing List From Order
This function adds the addresses from a previous order to the mailing. This call
returns a Mailing List GUID that can be used for obtaining address count information.
Add Address
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 24
Title String(15) The person’s title, e.g. Mr, Mrs etc.
FirstName String(30) The person’s first name.
Surname String(30) The person’s surname.
FullName String(100) The person’s full name. If not defined is defaulted to
Firstname and Surname.
JobTitle String(60) The person’s job title.
CompanyName String(50) The person’s company.
Email String(70) The person’s email address
Telephone String(20) The person’s telephone number.
DirectLine String(20) The person’s direct line telephone number.
Mobile String(20) The person’s mobile telephone number.
Facsimile String(20) The person’s fax number.
ExtraInfo String(50) Extra information.
Notes String(100) Notes.
CustomerAddressID String(100) Your own identification for this address.
CustomerImportID String(100) Your own identification for this set of addresses.
StreamPages1 Integer The number of pages to use from the first template on
the mail pack that is defined as “Preformatted Stream”.
The total pages for all addresses must match the total
number of pages in the template.
StreamPages2 Integer The number of pages to use from the second template
on the mail pack that is defined as “Preformatted
Stream”. The total pages for all addresses must match
the total number of pages in the template.
StreamPages3 Integer The number of pages to use from the third template on
the mail pack that is defined as “Preformatted Stream”.
The total pages for all addresses must match the total
number of pages in the template.
Custom1 String(50) Custom data.
Custom2 String(50) Custom data.
Custom3 String(50) Custom data.
Custom4 String(50) Custom data.
Custom5 String(50) Custom data.
Custom6 String(50) Custom data.
Custom7 String(50) Custom data.
Custom8 String(50) Custom data.
Custom9 String(50) Custom data.
Custom10 String(50) Custom data.
ReturnFormat String Specify as “Text” or “XML” see Return Formats.
Add Self
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 25
Auto Correct Addresses
This function applies correction to the addresses after all the addresses have been
added to the mailing.
This function applies proof option to the addresses after all the addresses have been
added to the mailing.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 26
4 - Delete and Cancel
The referenced calls in this section can be used to delete a mailing, delete data from
a mailing or cancel a mailing.
Delete Template
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 27
Delete Mailing List
Delete Mailing
Cancel Mailing
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 28
5 - Payment
The referenced calls in this section can be used to manage the processing, payment
and proof approval.
Process Mailing
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 29
HttpPostOnError String(500) A web http URL to call on error of the mailing. The
request parameters included are:
MailingGUID GUID
OrderRef Long
Success Boolean
Failure String
ReturnFormat String Specify as “Text” or “XML” see Return Formats.
This call returns the following data in the specified return format:
Mailing list corrected address count A count of the addresses that have been corrected. Only
returned once the mailing list addresses have been
validated.
Mailing list good address count A count of the addresses that have been validated. Only
returned once the mailing list addresses have been
validated.
Mailing list not validated address A count of the addresses that have not been validated.
count Only returned once the mailing list addresses have been
validated.
Mailing list western Europe count A count of the western Europe addresses. Only returned
once the mailing list addresses have been validated.
Mailing list rest of the world count A count of the rest of the world addresses. Only returned
once the mailing list addresses have been validated.
Mailing list surcharge postage A count of addresses that will incur a postal surcharge.
Only returned once the mailing list addresses have been
validated.
Mailing list missing field total address The number of addresses that have missing tags that are
count used in the mail pack. Only returned if the mailing has
missing fields.
Mailing list missing field address The count of addresses for each individual field that is
count for field [Field name] missing. Only returned if the mailing has missing fields.
Proof print sheets The number of sheets of paper used for the proof. Only
returned if a proof has been generated.
Proof print sides The number of sides of print on the proof. Only returned if
a proof has been generated.
C4 envelope count A count of the number of C4 envelopes that will be sent.
Only returned if there is more than one C4 envelope and a
proof has been generated.
C5 envelope count A count of the number of C5 envelopes that will be sent.
Only returned if there is more than one C5 envelope and a
proof has been generated.
Standard class postage address The number of addresses that will be sent standard class.
count Only returned if a proof has been generated.
Surcharge standard postage address The number of addresses that will be standard class but
count with a surcharge applied. Only returned if a proof has been
generated.
First class postage address count The number of first class addresses that will be sent. Only
returned if a proof has been generated.
Overseas postage address count The number of overseas addresses that will be sent. Only
returned if a proof has been generated.
Missing referenced font list Returns a list of fonts that will be substituted in the proof as
they have not been embedded into the document. Only
returned if a proof has been generated.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 31
Get Status
Status Description
Error in processing The process has errored, a failure message
should be sent to specified email list or
added to the HttpPostOnError.
Awaiting submitting for processing The process mailing call has not been made.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 32
Get Proof File
This call gets the PDF proof file for the mailing. The mailing must have been fully
processed before using this call, otherwise a failure will be returned.
This call gets the PNG format proof image file for a given page. The mailing must
have been fully processed before using this call, otherwise a failure will be returned.
This call will also fail if the skip preview image generation is set to true on the
process mailing call.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 33
Get Balance
This call get the current balance for the given account type. Returns Current Balance
for a top-up account, or Credit Limit, Credit Available and Amount owed for an
invoice account.
This call gets the mailing GUID for a given order reference.
This call user approves the mailing. Please note that the mailing will be submitted if
there is no further corporate approval required and auto submission is enabled on the
account; otherwise the mailing can be submitted by calling Process Mailing.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 34
Cancel Mailing Approval
This call cancels all approval on the mailing, allowing the mailing to be edited.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 35
6 - Lists
The referenced calls in this section can be used to obtain lists of data.
List Formats
List methods all have a list format, this can be specified as:
CSV (default)
The string returned will be in CSV format, with the first row containing the headers.
XML
An XML string conforming to the DataList schema that can be found at
https://www.cfhdocmail.com/LiveAPI2/DataList.xsd
List Mailings
This call returns the following columns of data ordered by latest order reference first:
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 37
List Mailings Page Count
This call retrieves the page count for a list of mailings, returns a page count of zero if
no mailings are found for the search criteria.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 38
List Library Templates
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 39
List Library Templates Page Count
This call retrieves the page count for a list of library templates, returns a page count
of zero if no templates are found for the search criteria.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 40
List Library Backgrounds
This call returns the following columns of data ordered by background name and
created on date:
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 41
List Library Backgrounds Page Count
This call retrieves the page count for a list of library backgrounds, returns a page
count of zero if no backgrounds are found for the search criteria.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 42
List Library Mail Packs
This call returns the following columns of data ordered by mail pack name and
created on date:
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 43
List Library Mail Packs Page Count
This call retrieves the page count for a list of library mail packs, returns a page count
of zero if no mail packs are found for the search criteria.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 44
List Library Mailing Lists
This call returns the following columns of data ordered by mail pack name and
created on date:
This call retrieves the page count for a list of library mailing lists, returns a page count
of zero if no mailing lists are found for the search criteria.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 45
List Mailing Filter Categories
This call is for corporate users only and returns a list of the mailing filter categories.
This call returns the following columns of data ordered Category name:
This call is for corporate users only and returns a list of mailing filter values for a
given category.
This call returns the following columns of data ordered Category name:
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 46
List Mailing Variable Values
This call is for corporate users only and returns a list of variable values for a given
mailing template GUID and variable name.
This call returns the following columns of data ordered Category name:
This call returns the following columns of data ordered product description:
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 47
List Document Types
This call returns a list of available document types for a given product type.
This call returns the following columns of data ordered by document type description:
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 48
List Template Variables
This call returns a list of available template variables for a given template. Please
note that before using this call for mailing templates a partial Process Mailing call
must be made to process the template. Additionally if custom address data is being
used then the mailing list must also have been added, otherwise the variable types
for the custom address fields will be returned as “Free text” rather than “Custom
address tag”.
This call returns the following columns of data, ordered as the variables are detected
in the file:
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 49
7 - Zip Data
The referenced calls in this section can be used to download a zip file of the mail
pack or mailing list data.
This call provides all the templates from a mail pack in a zip archive file.
This call provides a zip archive file containing a CSV file of the addresses on a
submitted mailing.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 50
8 - Account and User Administration
The referenced calls in this section can be used to add accounts or users to Docmail.
Create Account
This call creates a Docmail account. You must obtain permission from the Docmail
support team to use this call.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 51
Add User
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 52
Add User Organisation Structure Link
This call is for corporate users only and links a user to the organisational structure.
This call is for corporate users only and adds additional sign-up data for the user.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 53
9 - Mailing List Address Counts and Price Estimates
The referenced calls in this section are designed to obtain price estimates. The
address count calls can be used to obtain counts of addresses that can then be
passed to the price estimate call.
This function adds the addresses from a mailing list file to a temporary mailing list.
This call returns a Mailing List GUID that can be used for obtaining address count
information.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 54
Add Mailing List String For Address Count
This function adds the addresses from a formatted string to a temporary mailing list.
This call returns a Mailing List GUID that can be used for obtaining address count
information.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 55
Poll Mailing List For Address Count
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 56
Get Mailing Price Estimate
This function gets a price estimate for a mailing given a total number of expected
printed sides.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 57
Get Price Estimate
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 58
10 - Adding Library Data
The referenced calls in this section can be used to add data to the Library in Docmail.
This function adds a mailing list file to a library mailing list, creating the mailing list if it
does not already exist.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 59
Add Mailing List String To Library
This function adds the addresses from a formatted string to a library mailing list,
creating the mailing list if it does not already exist.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 60
Add Template File To Library
This call adds a template document to the library, overwriting the existing background
of the same name if it already exists.
This call allows a background file to be added to the library, overwriting the existing
background of the same name if it already exists.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 62
Add Mail Pack To Library
This call adds a mail pack to the library. Returns a mail pack GUID of either the
existing mail pack with the name supplied or a newly created mail pack if the name
does not exist.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 63
11 - Extended Calls
This section is for calling additional functionality that may be made available as
standard calls in future versions of the API.
Extended Call
Get the definition for an extended method, returns each parameter name and the
data type for use with the ExtendedCall method.
Parameter Data Type / Description
Max length
Username String(30) Docmail user name.
Password String(30) Password for the user.
MethodName String(50) The method name, see the Docmail API website for
details of any extended method names available.
ReturnFormat String Specify as “Text” or “XML” see Return Formats.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 64
Error codes
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 65
Example code
There are two options for referencing the web service, either using a service
reference or a web reference. The choice available will depend on your type of
project and version of .NET.
Service reference:
Right click on your project and select “Add Service Reference”.
Web reference:
Right click on your project and select “Add Web Reference”.
Enter the namespace or web reference name as “DMWS” if you want to follow the
code examples.
Click OK or Add Reference to add the service reference or web reference to the
project.
By default .NET 2005 and 2008 will limit the amount of information that can be
exchanged with the web service. In the binding section of the app.config or
web.config increase the message size as required, or set to a large default as shown
below:
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
maxStringContentLength="2147483647" maxArrayLength="2147483647"
By default .NET 2005 and 2008 will limit the time of a connection to 1 minute. This is
sufficient for most operations, but for very large files this may need increasing in the
binding section of the app.config or web.config. The example below shows
increasing the timeout to 5 minutes for uploading and downloading:
receiveTimeout="00:05:00" sendTimeout="00:05:00"
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 66
VB .NET code Samples
Code samples:
The following function convertes a text result string into a hash table for easy access
to the return data:
Private Function ResultHashTable(ByVal ResultData As String) As Hashtable
Dim oHashTable As New Hashtable
If Not ResultData = "" Then
For Each sLine As String In ResultData.Split(vbCrLf.ToCharArray)
If sLine <> "" Then
Dim iIndex As Integer = sLine.IndexOf(": ")
Dim sKey As String = sLine.Substring(0, iIndex)
Dim sData As String = sLine.Substring(iIndex + 2, sLine.Length -
iIndex - 2)
oHashTable.Add(sKey, sData)
End If
Next
End If
Return oHashTable
End Function
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 67
The following code places a mailing using a zip file that contains a configuration file
and any related template and mailing list files:
' Place the mailing
Dim oResultHash As Hashtable =
ResultHashTable(oService.CreateFileMailing("[Username]", "[Password]",
OpenFileAsByteArray("C:\Temp\Mailing.zip"), "Text"))
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 68
The following code checks the status, looping until the proof is ready and then saves
the proof file to disk:
' Poll the mailing status.
Do
oResultHash = ResultHashTable(oService.GetStatus("[Username]",
"[Password]", gMailingGUID, "Text"))
End Select
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 69
Glossary of terms
Address
The data relating to an individual person in the mailing. This includes
their name, address and any additional information to be merged in a
Template.
Background
A background is a PDF file that appears behind text entered in a main
document, for example a letter head.
Mailing
One of more templates that require sending to one or more addresses.
Mailings may also be referred to as orders.
Mailing List
The list of addresses that will receive the Mail Pack. A mailing list can be
saved via the Docmail website to be used over and over again.
Mail Pack
The collection of templates that are to be used in the mailing. Think of a
mail pack as a paperclip, holding different templates that you may want to
use together. Each mail pack will therefore always contain at least one
template, and possibly more. A mail pack can be saved via the Docmail
website to be used over and over again.
Template
A document file that will be sent to the mailing list. The document may
contain tags, e.g. <<FirstName>>, that can be replaced with either
address data or fixed variable data to produce the final output document.
Variable
A customisable tag in the template document that can be replaced with
either address data or fixed data. Fixed data will be the same text for all
recipients, for example <<SpecialOffers>>, could become “Spring Special
Offers”, or “Summer Special Offers”. Variables can be used for single
words or whole paragraphs of text.
Docmail Web Service v2.0 © 2011 CFH Total Document Management Ltd
Page 70