I want to send PDF file which is generated by VF page from Salesforce to XERO.
But I'm trying to send but it's not happening
XERO syntax, it receives like below format
POST /api.xro/2.0/Receipts/e59a2c7f-4078-a0f3-73537afcbba9/Attachments/Image00394.ddf
Here I'm not understanding how to pass PDF content in the URL above image00394 name.
Here is what I'm doing
string pdfcon='asdasdasdasd';
Blob pdfBody = EncodingUtil.base64Decode(pdfcon);
String endpoinurl='callout:Xero_Integration/api.xro/2.0/Invoices/32b8b9-4b5-45da-84ba-80e1bb47881/Attachments/';
HttpRequest req= new HttpRequest();
// set endpoint destination
req.SetEndpoint(endpoinurl);
req.setMethod('POST');
req.setHeader('xero-tenant-id','7bc01e1-d87-4a8b-9b96-2ffbc88f1cb8');
req.setHeader('Content-Type','application/pdf');
req.setBodyAsBlob(pdfBody);
Http http = new Http();
// send the request
HttpResponse response = http.send(req);
System.debug(response.getBody());
If I'm doing like below with filename mentioning in the URL, the PDF file is inserting but when I open it in XERO it showing below error:
String endpoinurl='callout:Xero_Integration/api.xro/2.0/Invoices/322cb8b9-40b5-45da-84ba-80e1bb437881/Attachments/'+pdfBody+'.pdf';
Finally I'm not understanding how to pass PDF content in the ENDPOINT URL of Http callouts?