title: Cannot add attachment to new RT ticket
body: <p>I'm currently using RT 4.4.3 in a project and I'm trying to create a new ticket with an attachment, using Java code.</p>
  
  <p>I tried to follow the instructions provided by <a href="https://github.com/bestpractical/rt-extension-rest2" rel="nofollow noreferrer">this BestPractical resource</a> hosted on GitHub and specified in this list of pulls.</p>
  
  <p>The code fragment that tries to perform the operation is the following:</p>
  
  <pre><code>PostMethod mPost = new PostMethod(TicketListConstants.SEGNALAZIONI_RTIR_URI + "/ticket");
  
          mPost.setRequestHeader("Content-type", "application/json");
          mPost.setRequestHeader("Authorization", TicketListConstants.SEGNALAZIONI_RTIR_TOKEN);
  
          /*String json = ;
          NameValuePair[] data = {
                  new NameValuePair("content", json)
          };*/
          UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(request);
          File file = uploadRequest.getFile("fileName");
          String filename = uploadRequest.getFileName("fileName");
  
          byte[] filecontent = this.encodeBase64(file);
  
          mPost.setRequestBody("{ \"Queue\": \"Infosharing\", \"Subject\": \""+subject+"\",\"From\":\""+currentUser.getEmailAddress()+"\",\"To\":\"test@liferay.com\",\"Owner\":\""
                                  +currentUser.getEmailAddress()+"\",\"Requestor\":\""+currentUser.getEmailAddress()+"\",\"Content\":\""+description+"\",\"AttachmentsContents\":[{\"FileName\":\""+filename+"\",\"FileType\":\"application/pdf\",\"FileContent\":\""+filecontent+"\"}]}");
          HttpClient cl = new HttpClient();
          String result = "";
          String newId = "";
          try {
              cl.executeMethod(mPost);
              result = mPost.getResponseBodyAsString();
  
              if (result != null) {
                  JSONObject json = null;
                  try {
                      json = JSONFactoryUtil.createJSONObject(result);
                  } catch (JSONException e) {
                      _log.error("Error extracting ticket info: "+e.getMessage());
                  }
                  newId = json.getString("id");
              }
          } catch (UnsupportedEncodingException e){
              _log.error("Error in searching tickets: "+e.getMessage());
          } catch (IOException io) {
              _log.error("Error in searching tickets: "+io.getMessage());
          }
  </code></pre>
  
  <p>So the JSON I'm sending to RT is the following:</p>
  
  <pre><code>{ "Queue": "Infosharing", "Subject": "Tutto in uno","From":"test@liferay.com","To":"test@liferay.com","Owner":"test@liferay.com","Requestor":"test@liferay.com","Content":"Aggiungo tutto in un solo passaggio","AttachmentsContents":[{"FileName":"prova.txt","FileType":"plain/text","FileContent":""}]}
  </code></pre>
  
  <p>The problem is that the ticket is correctly created but no attachment is added.</p>
  
  <p>I also tried to perform the same using SOAPUI but no attachment is added to the ticket even if the response is without any error.</p>
  
  <p>Could somebody help me what I'm doing wrong?</p>
  
  <p><strong>EDIT 2019-06-10:</strong> since it seems that, as reported <a href="https://metacpan.org/pod/RT::Client::REST::Attachment" rel="nofollow noreferrer">here</a>, at least till the end of December 2018:</p>
  
  <blockquote>
    <p>CREATING ATTACHMENTS Currently RT does not allow creating attachments
    via their API.</p>
    
    <p>See <a href="https://rt-wiki.bestpractical.com/wiki/REST#Ticket_Attachment" rel="nofollow noreferrer">https://rt-wiki.bestpractical.com/wiki/REST#Ticket_Attachment</a></p>
  </blockquote>
  
  <p>but it should be possible, as a temporary workaround, to post attachments to ticket's comments, can anybody help finding a solution to this problem?</p>