Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Creation of Attachments for invoices

Started by v v -   in API Endpoints

whenever I'm exporting the invoices through the api im seing the attatchment is being attatched to the invoice but when i comes over to xero app , no attatchments are added please help me on this please ASAP.
invoice.setAttachments(xeroService.loadAttatchments(invoiceUrl, InvoiceNumber()));

my loadAttatchments function:-
public ArrayOfAttachment loadAttatchments(String invoiceUrl, String invoiceNumber) throws IOException {
ArrayOfAttachment arrayOfAttachment = new ArrayOfAttachment();
String fileName =invoiceNumber + ".jpg";
Attachment attachment =new Attachment();
attachment.setUrl(invoiceUrl);
attachment.setFileName(fileName);
attachment.setStatus(EntityValidationStatus.OK);
attachment.setMimeType("application/jpeg");

//attachment=client.createAttachment("Invoices",invoiceNumber,fileName,"application/jpeg",IOUtils.toByteArray(XeroUtil.getInputStream(invoiceUrl)),Boolean.TRUE);
arrayOfAttachment.getAttachment().add(attachment);
return arrayOfAttachment;
}