goal: send a request that includes xml syntax via http post to
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
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
in a ruby file, let's say i have the following:
target_url = 'http://www.uptilt.com'
path = '/API/mailing_list.html'
http = Net::HTTP.new(target_url)
<? xml version='1.0' ?>
xml_response = http.post(path, xml_request)
(the rexml is for me to parse the xml data once i am able to receive a
i get the following when running the ruby file:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<title>400 Bad Request</title>
<p>Your browser sent a request that this server could not
.. 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
how should my (xml) request be constructed? please advise.