question

tweety5299 avatar image
tweety5299 asked ·

spring REST template to send fax with attachment

Hi, 

Please find below the REST call to the "send fax" api. 
Though the fax is being sent, the attachment is not sent.

Can you please help if the request is missing some entity?

byte[] attachment = getBVendorRenewalLetter();
MultiValueMap<String,Object> bodyMap = new LinkedMultiValueMap<String,Object>();
bodyMap.add("file", attachment);
bodyMap.add("to", "test phone number");
bodyMap.add("Authorization", accessToken);

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.setContentDispositionFormData("content", " testFile.pdf");
headers.add("to", "test phone number");
headers.add("Authorization", accessToken);

HttpEntity<Object> requestEntity = new HttpEntity<Object>(bodyMap, headers);

ResponseEntity<RingCentralResponseDTO> response = restTemplate.exchange(" https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/fax";, HttpMethod.POST, requestEntity, RingCentralResponseDTO.class);

Thank You very much
General Topic
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

· Write an Answer
ak avatar image
ak answered ·
Hi,

Please refer to the below sample in Java to send Fax:
https://github.com/vyshakhbabji/ringcentral-java/blob/master/src/utils/SendFax.java

3 comments
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Yes AK. It did. Thank you very much once again. I used the sample code to use the okHttp Client to make the REST call and it works great ! 


1 Like 1 ·
Thank you for the pointer.
0 Likes 0 ·
You are welcome Tweety. Did the sample code help ?
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.