RESTful API Problems
All,
Trying to write a very simple library for sending tickets to our Lighthouse Project. This is the code that I am using:
def self.create_new_ticket(name, email, phone, dealership, tag, title, body)
http_conn = Net::HTTP.new(TRACKER_URI)
data = build_new_ticket(name, email, phone, dealership, tag, title, body)
headers = {'Content-Type' => 'text/xml'}
http_conn.post(NEW_TICKET_PATH, data, headers)
end
def self.build_new_ticket(name, email, phone, dealership, tag, title, body)
xml_str = '<ticket>'
xml_str += "<title>#{title}</title>\n"
xml_str += "<tag>#{tag}</tag>"
xml_str += "<body>Name: #{name}\nEmail: #{email}\nPhone: #{phone}\nDealership: #{dealership}\n\n#{body}</body>"
xml_str += "<state>new</title>"
xml_str += '</ticket>'
end
I get a 200 response back, but a 500 internal error? Also has anyone gotten Builder::XmlMarkup to generate the correct XML? I tried but it kept giving me and Error:"Title can't be blank", but title was not blank.
Thanks
Comments are currently closed for this discussion. You can start a new one.