
This post only applies to Legacy Version 3 of the API
In the first two parts of this series, Washing With SOAP: Part 1 and Washing With SOAP: Part 2, we saw how a SOAP testing tool, such as soapUI, can be used to test and learn about a particular web service; In this case, the Bronto API. We logged in to the API, created some contacts, and retrieved some contacts. These operations are useful for keeping a contact database in sync with Bronto. In this post, we’ll look at how to actually schedule a delivery.
Create a List
You can send to a list, contact, segment, or combinations of all three. In this case, we’ll actually be sending to a list that has been created in the Bronto application. You can manage your lists and segments in the application and send to them from the API, but you’ll need to obtain the id of the list or segment first.
Login and Retrieve the List and Messages IDs
Refer to Part 2 if you need to review how to login and obtain a session ID. I previously created a list in Bronto called “mynewsletter”, and as you can see in the request, I specified this in the filter criteria. You can also retrieve all of the lists by not specifying any filter criteria, but we know the name of the list, so let’s use it. We also need to know the id of the message we want to send, so we need to use the appropriate read operation and filter. Here I have retrieved a message called “julynewsletter”.
Request – readLists
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://api.bronto.com">
<soapenv:Header>
<api:sessionHeader>
<api:sessionId>aaaa1111bbbb2222cccc3333dddd</api:sessionId>
</api:sessionHeader>
</soapenv:Header>
<soapenv:Body>
<api:readLists>
<api:attributes>
<!--Optional:-->
<api:label>true</api:label>
<!--Optional:-->
<api:activeCount>true</api:activeCount>
</api:attributes>
<api:filter>
<!--Zero or more repetitions:-->
<api:criteria>
<api:attribute>name</api:attribute>
<api:comparison>=</api:comparison>
<api:value>
<api:type>string</api:type>
<api:value>mynewsletter</api:value>
</api:value>
</api:criteria>
<!--Optional:-->
<api:operator></api:operator>
</api:filter>
</api:readLists>
</soapenv:Body>
</soapenv:Envelope>
Response – readLists
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.bronto.com">
<SOAP-ENV:Body>
<ns1:readListsResponse>
<ns1:return>
<ns1:lists>
<ns1:id>eeee1111ffff2222gggg3333hhhh</ns1:id>
<ns1:name>mynewsletter</ns1:name>
<ns1:label>My Newsletter</ns1:label>
<ns1:activeCount>2</ns1:activeCount>
</ns1:lists>
</ns1:return>
</ns1:readListsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Request – readMessages
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://api.bronto.com">
<soapenv:Header>
<api:sessionHeader>
<api:sessionId>aaaa1111bbbb2222cccc3333dddd</api:sessionId>
</api:sessionHeader>
</soapenv:Header>
<soapenv:Body>
<api:readMessages>
<api:attributes>
<!--Optional:-->
<api:status>true</api:status>
<!--Optional:-->
<api:messageFolderId>true</api:messageFolderId>
<!--Optional:-->
<api:content>false</api:content>
</api:attributes>
<api:filter>
<!--Zero or more repetitions:-->
<api:criteria>
<api:attribute>name</api:attribute>
<api:comparison>=</api:comparison>
<api:value>
<api:type>string</api:type>
<api:value>julynewsletter</api:value>
</api:value>
</api:criteria>
<!--Optional:-->
<api:operator></api:operator>
</api:filter>
</api:readMessages>
</soapenv:Body>
</soapenv:Envelope>
Response – readMessages
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.bronto.com">
<SOAP-ENV:Body>
<ns1:readMessagesResponse>
<ns1:return>
<ns1:messages>
<ns1:id>gggg1111hhhh2222eeee3333</ns1:id>
<ns1:name>wysiwygmessage</ns1:name>
<ns1:status>approved</ns1:status>
<ns1:messageFolderId>aaaa000000000000000000000000bbbb</ns1:messageFolderId>
</ns1:messages>
</ns1:return>
</ns1:readMessagesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Schedule The Delivery
You can schedule a delivery to be sent immediately, by specifying “now” as the send time, or you can alternately specify a UTC date and time. Try scheduling the delivery for far enough in the future so that you have time to log into the application and see it in your outbox. Let’s schedule something for tomorrow morning at 9:00 AM EDT(13:00 UTC).
Request – writeDeliveries
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://api.bronto.com">
<soapenv:Header>
<api:sessionHeader>
<api:sessionId>a260a7b0e50bbef3b9e5b517d712ccd2</api:sessionId>
</api:sessionHeader>
</soapenv:Header>
<soapenv:Body>
<api:writeDeliveries>
<!--1 or more repetitions:-->
<api:deliveries>
<api:start>2009-07-31 13:00:00</api:start>
<!--Optional:-->
<api:messageId>gggg1111hhhh2222eeee3333</api:messageId>
<!--1 or more repetitions:-->
<api:recipients>
<api:type>list</api:type>
<api:id>eeee1111ffff2222gggg3333hhhh</api:id>
</api:recipients>
<!--Optional:-->
<api:fromEmail>me@mydomain.com</api:fromEmail>
<!--Optional:-->
<api:fromName>It's Me</api:fromName>
<!--Optional:-->
<api:replyEmail>me@mydomain.com</api:replyEmail>
<!--Optional:-->
<api:optin></api:optin>
</api:deliveries>
<api:handler>
<api:mode>insert</api:mode>
</api:handler>
</api:writeDeliveries>
</soapenv:Body>
</soapenv:Envelope>
Response – writeDeliveries
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.bronto.com">
<SOAP-ENV:Body>
<ns1:writeDeliveriesResponse>
<ns1:return>
<ns1:result>
<ns1:id>jjjj1111kkkk2222llll3333</ns1:id>
<ns1:success>true</ns1:success>
<ns1:isNew>true</ns1:isNew>
</ns1:result>
</ns1:return>
</ns1:writeDeliveriesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
If you log into the application, you will see this delivery just as if it had been scheduled in the application. Now that you’ve seen how to use some of the most commonly used operations, and have an easy way to access and try out API operations without writing code, go explore some of the other operations. For instance, you may want to collect open and click data about your contacts and deliveries that can be used in a custom data analysis report. In an upcoming post we’ll look at some code that uses the readOpens and readClicks functions.
For informationon on the Bronto API visit http://api.bronto.com/, or feel free to leave us a comment in the comments section below.
Alex Durzy
Support Engineer at Bronto
Related posts:
- Washing With SOAP: Part 2 This post only applies to Legacy Version 3 of the...
- Washing With SOAP: Part 1 This post only applies to Legacy Version 3 of the...
- Who Loves You: Getting Open Rates Via The API This post only applies to Legacy Version 3 of...
{ 3 trackbacks }
{ 0 comments… add one now }