z4r / python-rtkit

Python Api for Request Tracker's REST interface
http://z4r.github.com/python-rtkit/
Other
68 stars 44 forks source link

There was a bug when using the existing create ticket code for RT 4.0.1, #4

Closed ctrlspc closed 12 years ago

ctrlspc commented 12 years ago

The work around for this is to change the payload so that the root attribute for the post request is content, which contains a dictionary of the ticket attributes.

If you don't do this on my version of RT the output looks like: [DEBUG] POST ticket/new [DEBUG] {'Content-Length': '459', 'Content-Type': 'multipart/form-data; boundary=xXXxXXyYYzzz', 'Accept': 'text/plain'} [DEBUG] '--xXXxXXyYYzzz\r\nContent-Disposition: form-data; name="Queue"\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Length: 1\r\n\r\n1\r\n--xXXxXXyYYzzz\r\nContent-Disposition: form-data; name="Text"\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Length: 47\r\n\r\nMy%20useless%0A%20text%20on%0A%20three%20lines.\r\n--xXXxXXyYYzzz\r\nContent-Disposition: form-data; name="Subject"\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Length: 12\r\n\r\nNew%20Ticket\r\n--xXXxXXyYYzzz--\r\n' [INFO] POST [INFO] http:///REST/1.0/ticket/new [DEBUG] HTTP_STATUS: 200 OK [DEBUG] 'RT/4.0.1 200 Ok\n\n# Required: id, Queue\n\nid: ticket/new\nQueue: \nRequestor: APIUser\nSubject: \nCc:\nAdminCc:\nOwner: \nStatus: new\nPriority: \nInitialPriority: \nFinalPriority: \nTimeEstimated: 0\nStarts: 2012-01-19 11:56:59\nDue: 2012-01-19 11:56:59\nText: \n\n' [DEBUG] RESOURCE_STATUS: 200 Ok [INFO] [[('id', 'ticket/new'), ('Queue', ''), ('Requestor', 'APIUser'), ('Subject', ''), ('Cc', ''), ('AdminCc', ''), ('Owner', ''), ('Status', 'new'), ('Priority', ''), ('InitialPriority', ''), ('FinalPriority', ''), ('TimeEstimated', '0'), ('Starts', '2012-01-19 11:56:59'), ('Due', '2012-01-19 11:56:59'), ('Text', '')]] [INFO] [[('id', 'ticket/new'), ('Queue', ''), ('Requestor', 'APIUser'), ('Subject', ''), ('Cc', ''), ('AdminCc', ''), ('Owner', ''), ('Status', 'new'), ('Priority', ''), ('InitialPriority', ''), ('FinalPriority', ''), ('TimeEstimated', '0'), ('Starts', '2012-01-19 11:56:59'), ('Due', '2012-01-19 11:56:59'), ('Text', '')]]

Signed-off-by: Jason Marshall ctrlspc@gmail.com