In version 3.6 I used the code below to create a ticket via API. After migrating to version 5, the tickets are created, but when pressing the ‘Reply’ on the ticket, the reply address is wrong. I checked the documentation and I could not find the reason. Could you please help?
Map<String,Object> doc = new HashMap<>();
doc.put( "title", StringUtil.isFilledTrim( title ) ? title : "DbSchema Report Bug");
doc.put( "group_id", 1);
doc.put( "customer_id", "guess:support@dbschema.com" );
doc.put( "state_id", 2 );
final Map<String,Object> article = new HashMap<>();
article.put( "subject", StringUtil.isFilledTrim( title ) ? title : "DbSchema Report Bug");
article.put( "body", message );
article.put( "internal", "false" );
article.put( "to", email );
article.put( "cc", email );
article.put( "content_type", "text/html" );
article.put( "type", "web" );
doc.put( "article", article );
if ( !attachments.isEmpty() ) {
final List<Map> attachmentList = new ArrayList<>();
article.put( "attachments", attachmentList );
for (File file : attachments) {
try {
final Map<String, Object> attachmentMap = new HashMap<>();
attachmentList.add(attachmentMap);
attachmentMap.put("filename", file.getName());
final RandomAccessFile f = new RandomAccessFile(file, "r");
final byte[] bytes = new byte[(int)f.length()];
f.readFully(bytes);
attachmentMap.put("data", new String(java.util.Base64.getEncoder().encode( bytes ), StandardCharsets.UTF_8));
attachmentMap.put("mime-type", getContentType(file));
} catch ( IOException ex ){
Log.error( ex );
}
}
}
return new GsonBuilder().setPrettyPrinting().create().toJson(doc);