Back in February, user ‘toml at bitstatement’ (
Carbon60: Cloud Consulting - Services and Solutions) posted a
question about interfacing with RT from Ruby via REST. That thread is
archived here:Carbon60: Cloud Consulting - Services and Solutions
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
innocent):
-----snip-----
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
–905815
Content-Disposition: form-data;
name=“attachment.txt”; filename=“attachment.txt”
Content-Type: text/plain
test attachment content
–905815
Content-Disposition: form-data; name=“content”
Ticket: 5702
Action: comment
Text: Adding attachment(s).
Attachment: attachment.txt
–905815–
-----snip-----
And the response from RT:
-----snip-----
HTTP/1.1 200 OK
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
40
RT/3.8.1 400 Bad Request
No attachment for attachment.txt.
-----snip-----
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?