[rt-users] ruby -> REST

Tom Lahti toml at bitstatement.net
Mon Feb 16 16:40:14 EST 2009


I am working on some code in ruby that accesses the REST interface.  I am
running RT 3.8.2.  I am able to login, save cookies, and retrieve tickets
and history without problems.

My problem starts when I try to use REST to add a comment/correspondence to
a ticket.  The following code:

----------------------------------------------------
url = "#{REST}ticket/846/comment"
req = Net::HTTP::Post.new(url)
req.add_field 'User-Agent',UA
req.add_field 'Cookie',cookie
req.set_form_data( { "Action" => "comment",
                     "Text" => "This is some text" } )

response,data = http.request(req)

puts response.code + " "  + response.message
puts "Data: "
puts data
----------------------------------------------------

produces this output:

====================================================
200 OK
Data:
no value sent for required parameter 'changes'
Stack:
  [/opt/rt38/share/html/REST/1.0/dhandler:285]
  [/opt/rt38/share/html/REST/1.0/autohandler:54]
  [/opt/rt38/share/html/autohandler:311]
====================================================

I've looked at /opt/rt38/share/html/REST/1.0/dhandler line 285 and there is
a method call $m->comp with no mention of a parameter named 'changes', which
is quite possibly the problem. Later in the file there is another $m->comp
call that has a 'changes' parameter.

I suspect this is a bug in share/html/REST/1.0/dhandler.  But what I don't
understand is why the RT command line tool can do it and I can't.  Anyone
else run into this?



-- 
-- ============================
   Tom Lahti
   BIT Statement LLC

   (425)251-0833 x 117
   http://www.bitstatement.net/
-- ============================



More information about the RT-Users mailing list