[rt-users] Ruby -> REST, part 2

Three Tee threetee at gmail.com
Thu Apr 23 00:42:56 EDT 2009

Back in February, user 'toml at bitstatement' (
http://www.gossamer-threads.com/lists/engine?user=7874;list=rt) posted a
question about interfacing with RT from Ruby via REST. That thread is
archived here:http://www.gossamer-threads.com/lists/rt/users/82898

I am having a similar problem, but when I implemented the solution described
in that thread, RT still won't accept the comment.

Request from my Ruby application (hostnames have been changed to protect the

POST /REST/1.0/ticket/5702/comment HTTP/1.1
Accept: application/xml
Content-Type: multipart/form-data; boundary="905815"
Cookie: RT_SID_RTNAME.80=132575bdeee36284a05518c9b8080edf; path=/
Cookie2: $Version="1"
Host: rthost.somewhere.com
Content-Length: 308

Content-Disposition: form-data;
name="attachment.txt"; filename="attachment.txt"
Content-Type: text/plain

test attachment content
Content-Disposition: form-data; name="content"

Ticket: 5702
Action: comment
Text: Adding attachment(s).
Attachment: attachment.txt


And the response from RT:
HTTP/1.1 200 OK
Date: Thu, 23 Apr 2009 02:22:53 GMT
Server: Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.7f PHP/5.2.6
mod_perl/2.0.4 Perl/v5.8.6
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8

RT/3.8.1 400 Bad Request

# No attachment for attachment.txt.

I assume from the RT error message that it is parsing the "content" form
field, or else it wouldn't know to look for the attachment.txt file, but I
can't figure out what's wrong. Anyone have any ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090422/6f963bf8/attachment.htm>

More information about the rt-users mailing list