RESTful API Problems

Evin Grano's Avatar

Evin Grano

02 Nov, 2007 06:37 PM

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

Discussions are closed to public comments.
If you need help with Lighthouse please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac