hello,

goal: send a request that includes xml syntax via http post to
emaillabs' api
problem: would like help in constructing the (xml) request properly


if one scrolls to the bottom of the emaillabs api overview
documentation here (http://www.emaillabs.com/email-marketing/api-
faq.html) under 'What is an example of an API command?',

notice the 'type' and 'activity' parameters.  these, along with the
'input' parameter which is the xml 'input from customer' from
<dataset>.. through </dataset>, are required according to the api
reference guide.

i'm using the net/http toolkit to try to post the request to emaillabs
so that i might receive some xml response back.

question: how would you incorporate the 'type: record', 'activity:
query-data', and 'input: <dataset>...</dataset>' parameters all
together in the (xml) request?

i tried to send everything together, but i suspect that this is not
correct.
in a ruby file, let's say i have the following:

#!/usr/bin/env ruby

require 'net/http'
require 'rexml/document'
include REXML

target_url = 'http://www.uptilt.com'
path = '/API/mailing_list.html'

http = Net::HTTP.new(target_url)

xml_request =<<EOF
Type:record
Activity:query-data
Input:
<? xml version='1.0' ?>
<DATASET>
<SITE_ID>123456789</SITE_ID>
<MLID>987654321</MLID>
<DATA type='email'>someuser / somedomain.com</DATA>
</DATASET>
EOF

xml_response = http.post(path, xml_request)

puts xml_response.body


(the rexml is for me to parse the xml data once i am able to receive a
response.)


i get the following when running the ruby file:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not
understand.<br />
</p>
</body></html>

.. so that i suspect my request isn't constructed properly.  i've also
tried using 'END' in lieu of 'EOF', and double quotes to hold the
data, but i'm guessing that the type/activity/input are the problem.
i've also tried to put them in xml tags, but that still produced the
same 'response'.  i've also ensured that the api security settings are
set up properly, and that i'm contacting the correct url location
(different from target_url, path, and in the emaillabs api faq
example).

how should my (xml) request be constructed?  please advise.