4

Does anyone know how to create a ticket with attachment in RT (Request Tracker) using REST service with PHP script?

Will Hartung
  • 115,893
  • 19
  • 128
  • 203
Misha
  • 5,260
  • 6
  • 35
  • 63
  • Is the request tracker you talk about a specific product? – Pekka Feb 27 '11 at 14:00
  • @Pekka: http://bestpractical.com/rt/ – joschi Feb 27 '11 at 16:00
  • @joshi ah, nice. @Mike they have some documentation here: http://requesttracker.wikia.com/wiki/REST it's very sparse though – Pekka Feb 27 '11 at 16:12
  • I saw all these. Looks like there is no way to create a ticket with attachment but it is possible to comment with attachment already existant ticket. However when i try to cooment using PHP i get "RT/3.8.9 400 Bad Request # No attachment for /tmp/img2.PNG" error. I'm adding attachment like this: $post_data=array("content"=>"id: 23\n". "Action: Correspond\n". "Text: ZZZZZZZZZZZZZZZZZZ\n". "Attachment: ".$attachmentName."\n". "attachment_1: /tmp/img2.PNG" – Misha Feb 28 '11 at 11:08
  • hi. can you provide some post-request body example please? – Alexiuscrow Jun 25 '19 at 12:03

2 Answers2

1

remove "attachment_1: /tmp/img2.PNG" add a POST a variable using addPostFile() with name "attachment_1" that contains the raw attachment.

singam
  • 26
  • 1
0

If you are using HTTP_Request, the function is addFile() instead of addPostFile(). -It worked for me.