Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

The MailUp RubyGem is currently being worked on, and will be released soon. This document will be updated with the gem is released.

Requirements

You will need to create a MailUp account in order to use the API. Once you have created your account, follow these instructions to activate the API for your account, so that you can get your API username and password. (Please note that the username/password required to access the API is different than the username/password used to access your MailUp account.)

Installation

(sudo) gem install mailup

Usage

The RubyGem provides wrappers for each of the following API classes:

The following examples show how to use each class, and additional code examples are available for each method in the API documentation.

HTTP GET/POST API

Interacting with the GET/POST API only requires your console_url, which is the base URL of your MailUp administrative interface (without the http://). For example, when you login to your MailUp administrative interface the URL might be something like http://abc123.s22.it/console/default.aspx. In that case, you would access the GET/POST API with the following:

m = MailUp::API.new('abc123.s22.it')
m.xml_subscribe(:email => 'sample@email.com', :list => 1)
 
# => 0

Please refer to the documentation for each method of the GET/POST API for more code examples.

MailUp Import SOAP WebService

Make sure to activate the WSMailUpImport web service in order to use this service. Interacting with the Import web service requires your API username and password as well as your console_url:

m = MailUp::Import.new('x123456', 'api-password', 'abc123.s22.it')
m.new_import_process(
  :idList          => 1,
  :xmlDoc          => contacts_xml_string,
  :mobileInputType => 1,
  :idGroups        => "1, 3, 5",
  ...
)
 
# Returns the 'idProcess' of the newly created process
# => 17

The RubyGem outputs the XML response from the API, so that you can parse it as needed and rescue for error responses as needed. Please refer to the documentation for each method of the MailUp Import SOAP WebService for more error code explanations, sample responses, and code examples.

MailUp Send SOAP WebService

Make sure to activate the WSMailUpSend web service in order to use this service. Interacting with the Send web service requires only your API username and password:

m = MailUp::Send.new('x123456', 'api-password')
m.get_lists

 
# Returns the XML response
# => "<GetListsResult><errorCode>0</errorCode><errorDescription></errorDescription><lists><list><listID>1</listID><listName>News</listName></list></lists></GetListsResult>"

The RubyGem outputs the XML response from the API, so that you can parse it as needed and rescue for error responses as needed. Please refer to the documentation for each method of the MailUp Send SOAP WebService for more error code explanations, sample responses, and code examples.

MailUp Manage SOAP WebService

Make sure to activate the WSMailUpManage web service in order to use this service. Interacting with the Send web service requires only your API username and password:

m = MailUp::Manage('x123456', 'api-password')
m.update_list(
  :listID  => 1,
  :options => {
    "Option" => {
      "Key"   => "owneremail",
      "Value" => "sample@email.com"
    },
    "Option" => {
      "Key"   => "description",
      "Value" => "list description..."
    }
  }
)

 
# Returns the XML response
# => "<UpdateListResult><errorCode>0</errorCode><errorDescription></errorDescription><list><listID>1</listID> ... </list></UpdateListResult>"

The RubyGem outputs the XML response from the API, so that you can parse it as needed and rescue for error responses as needed. Please refer to the documentation for each method of the MailUp Manage SOAP WebService for more error code explanations, sample responses, and code examples.

MailUp Report SOAP WebService

Make sure to activate the WSMailUpReport web service in order to use this service. Interacting with the Send web service requires only your API username and password:

m = MailUp::Report('x123456', 'api-password')
m.report_by_message(
  :listID    => 1,
  :messageID => 1
)

 
# Returns the XML response
# => "<ReportByMessageENResult><errorCode></errorCode><errorDescription></errorDescription><Clicks Url="" Total=""> ... </Clicks><Opens Total=""><Open Email="" Total="" /> ... </Opens></ReportByMessageENResult>"

The RubyGem outputs the XML response from the API, so that you can parse it as needed and rescue for error responses as needed. Please refer to the documentation for each method of the MailUp Report SOAP WebService for more error code explanations, sample responses, and code examples.

Supported Methods

You can easily find out what API methods are supported by each object via the public_methods method:

m = MailUp::Send.new('username', 'password')
m.public_methods
 
# Returns supported API methods:
# => [... :get_id_user, :get_lists_user, :get_lists, :get_groups, :get_templates, :get_newsletters ...]
This section is under construction.
  • No labels