You need to sign in to do that
Don't have an account?
Add a PDF File to HttpRequest 'POST' REST
Hi,I wana to delivre (send) a PDF file to externe Web Service using HttpRequest 'POST' (with REST), and i dont know how i must proceed.
hat's wath i have do at now :
String Id ='500S00000012tjM'; PageReference pageRef = new PageReference('/apex/GenererPDF?id='+Id); Blob PDF = pageRef.getContentAsPDF(); String endpointSend = 'https://WebServiceTEst'; HttpRequest reqSend = new HttpRequest(); reqSend.setEndpoint(endpointSend); reqSend.setMethod('POST'); Blob headerValueSend = Blob.valueOf(usrName + ':' + psswd ); String authorizationHeaderSend= 'Basic ' + EncodingUtil.base64Encode(headerValueSend); reqSend.setHeader('Authorization', authorizationHeader); reqSend.setHeader('content-type', 'application/pdf'); //String BlodPDF = EncodingUtil.base64Encode(PDF); System.debug('22222222' + EncodingUtil.base64Encode(PDF)); reqSend.setBody(EncodingUtil.base64Encode(PDF)); Http httpLoadPDF = new Http();