Copy link to clipboard
Copied
Not Able to upload document to adobe Sign By using Rest Api
EndPoint :https://api.na1.adobesign.com/api/rest/v6/transientDocuments
Am trying like below
HttpHeaders headers=new HttpHeaders();
String token="Bearer "+getAccessToken();
headers.set("Authorization",token);
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
HttpHeaders pdfHeaders=new HttpHeaders();
pdfHeaders.setContentType(MediaType.APPLICATION_PDF);
String fileName=consentFormDto.getFile().getOriginalFilename();
ByteArrayResource byteArrayResource=new ByteArrayResource(consentFormDto.getFile().getBytes()){
@Override
public String getFilename(){
return fileName;
}
};
HttpEntity<ByteArrayResource> pdfEntity=new HttpEntity<>(byteArrayResource,pdfHeaders);
MultiValueMap<String,Object> requestParts=new LinkedMultiValueMap<>();
requestParts.add("File",pdfEntity);
String url="https://api.na1.adobesign.com:443/api/rest/v6/transientDocuments";
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(requestParts, headers);
String response = restTemplate.postForObject(url, requestEntity, String.class);
Attching error stack also
Please help to resolve This issue
Have something to add?