Zendesk/Jersey: and MIME media type, application/octet-stream, was not found

lucievfedrrikts

New Member
Appreciate any help on this:Error Log:Tests in error: testCreateTicketComment(com.abc.ticketing.service.TicketingServiceTest): com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class com.abc.ticketing.data.zendesk.attachment.Attachment, and MIME media type, application/octet-stream, was not foundpom.xml\[code\] <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.6</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>1.6</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-core</artifactId> <version>1.6</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>1.6</version> <scope>compile</scope> </dependency>\[/code\]class:\[code\]public String addAttachment(String filename, String url) { Attachment attachment = new Attachment(); attachment.setFilename(filename); attachment.setUrl(url); AttachmentWrapper result = apiFactory.getAttachmentAPI().addAttachment(attachment); \[/code\]AttachmentAPI:\[code\]public class AttachmentAPI { private final WebResource rootResource; public AttachmentAPI(WebResource rootResource) { super(); this.rootResource = rootResource; } public AttachmentWrapper addAttachment(Attachment attachment) { return rootResource.path("/api/v2/uploads.json").accept(MediaType.APPLICATION_JSON_TYPE).type(MediaType.APPLICATION_OCTET_STREAM_TYPE).post(AttachmentWrapper.class, attachment); }}\[/code\]I am trying to use Zendesk's API to add attachment to a ticket, which says the Content-Type header should be "application/binary".Any clue will be really helpful. Zendesk API: \[code\]curl -u username:password -H "Content-Type: application/binary" \ --data-binary @file.dat -X POST \ https://helpdesk.zendesk.com/api/v2/uploads.json?filename=myfile.dat&token={optional_token}\[/code\]
 
Top