question

dat-le5843 avatar image
dat-le5843 asked Phong Vu commented

Get an error when trying to resend a fax through API

Can't resend a fax. I get the below message in the ErrorResponseBody


{


"errorCode" : "InvalidParameter",

"message" : "Parameter [originalMessageId] value is invalid",

"errors" : [ {


"errorCode" : "CMN-101",

"message" : "Parameter [originalMessageId] value is invalid",

"parameterName" : "originalMessageId"

} ],

"parameterName" : "originalMessageId"

}


rest apifaxerrors
1 |1500 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.

Tyler Liu avatar image
Tyler Liu answered dat-le5843 commented
Which API endpoint are you invoking? Could you please post some code?
4 comments
1 |1500 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.

I am using the ringcentral-csharp-client SDK.

Here is the code that fails upon trying to resend a fax. I already get the token for the RestClient prior to calling this method

       private async Task<MessageInfo> ResendFax(RestClient rc, string messageId)
        {
            var extension = rc.Restapi().Account().Extension();
            
            return await extension.Fax()
                .Post(new FaxPath.PostParameters()
                {
                    originalMessageId = messageId
                }, new List<Attachment>());
        }

It is a valid message id as I can get the call log for it via

                var extension = _restClient.Restapi().Account().Extension();
                return extension.MessageStore(requestId).Get().Result;


0 Likes 0 ·
Frankly speaking, I have never tried resending fax. Let me take a look.
0 Likes 0 ·
It turns out that send fax is multipart/mixed while resend fax is application/json. So you cannot reuse the send fax code to resend fax.

Please try the following:

var messageInfo = rc.Post<MessageInfo>(Restapi().Account().Extension().Fax().Endpoint(), new { originalMessageId = messageId });



0 Likes 0 ·
Thanks! That worked for me, with the exception of small change

rc.Post<MessageInfo>( rc.Restapi().Account().Extension().Fax().Endpoint(),
                new {originalMessageId = messageId});

0 Likes 0 ·
Ramakrishna Reddy G avatar image
Ramakrishna Reddy G answered Phong Vu commented

How can we get messageId in Fax call?.

1 comment
1 |1500 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.

This is the response after you send a fax message:

HTTP 200 OK

{
  "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/691748004/extension/691748004/message-store/1277646004",
  "id" : 1277646004,
  "to" : [ {
    "phoneNumber" : "+18774880001",
    "messageStatus" : "Queued"
  }, {
    "phoneNumber" : "+18004778345",
    "messageStatus" : "Queued"
  } ],
  "type" : "Fax",
  "creationTime" : "2016-06-14T13:38:06.000Z",
  "readStatus" : "Unread",
...

The id is the messageId you are looking for. See more from the API reference


0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys