Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Thursday, October 09, 2014

Command Center: Bob Discovers the JangoMail API

By: JangoMail Development
Bob's business is growing. Bob's sales staff needs to use email to make more connections with leads, and to promote more sales to existing customers. Bob's sales staff, however, isn't so great at learning new things. Bob already has his own software to run his business, and his sales staff doesn't like going outside of it to use other tools.

Bob needs his sales staff to use JangoMail's tools, but he wants them to do so directly from his own sales software. After all, his IT and development staff have worked hard to make his software work very well for his purposes.

That's why Bob uses the JangoMail API. API stands for Application Programming Interface. The JangoMail API lets Bob's developer connect his software directly to JangoMail.

Now Bob's sales staff can create messages, build contact lists, and send campaigns directly from Bob's own software. Bob's sales software, with JangoMail's API, brings more power, success, and money to Bob's organization.

But wait, there's more! The JangoMail API gives Bob's software access to reporting, transactional and campaign sending, contact management, account management, and many more features. Almost everything you can do within JangoMail can be done through the JangoMail API. Check for bounces. Count your opens. Do it all!

If you act now, we'll also include the ability to make requests through SOAP, HTTP GET, or HTTP POST. We'll even let you pull the data as string, .NET dataset, or XML.

All of this, AND MORE, for the great low, low price of nothing in addition to your normal subscription costs. That's right, access to the API is free for JangoMail customers. Yes, even free trial customers.

Want to know more about how the JangoMail API like Bob does? Click here to read more. You'll be cool if you do it, just like Bob.


Monday, March 19, 2012

Calling the JangoMail Web Service in Python

Python is a language that seems to make so many mundane programming tasks easy. Unfortunately, some python libraries are perhaps less fully developed than the libraries of other languages. This is certainly the case of the python soap libraries SOAPpy and SUDS. In my experience, both libraries are painfully buggy. In python, I think it's easier just to use httplib and build the xml manually. Luckily, python's other conveniences make that pretty easy!

In this example, we build an xml template for calling Groups_GetList_String. To test it with your own account, just insert your own JangoMail/JangoSMTP credentials. Download the source code for this example to start your own integration!


import sys
import httplib

# setup the sml template xml for a call to Groups_GetList_String
SM_TEMPLATE = """<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Groups_GetList_String xmlns="http://api.jangomail.com/">
      <Username>%s</Username>
      <Password>%s</Password>
      <RowDelimiter>%s</RowDelimiter>
      <ColDelimiter>%s</ColDelimiter>
      <TextQualifier>%s</TextQualifier>
    </Groups_GetList_String>
  </soap12:Body>
</soap12:Envelope>
"""

# fill in the parameters for our call
SoapMessage = SM_TEMPLATE%("Your JangoMail/JangoSMTP Username", 
              "Your Password", "\n", " - ", "")

# examine the soap message that we have constructed
print SoapMessage

# insert the proper values into the header
webservice = httplib.HTTP("api.jangomail.com")
webservice.putrequest("POST", "/api.asmx")
webservice.putheader("Host", "api.jangomail.com")
webservice.putheader("User-Agent", "Python post")
webservice.putheader("Content-type", 
    "application/soap+xml; charset=\"UTF-8\"")
webservice.putheader("Content-length", "%d" % len(SoapMessage))
webservice.putheader("SOAPAction", 
    "http://api.jangomail.com/Groups_GetList_String")
webservice.endheaders()
webservice.send(SoapMessage)

# get the response and print it
statuscode, statusmessage, header = webservice.getreply()
print "Response: ", statuscode, statusmessage
print "headers: ", header
res = webservice.getfile().read()
print res