Get an error when trying to resend a fax through API

  • 1
  • Problem
  • Updated 1 year ago
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"
}
Photo of Dat Le

Dat Le

  • 160 Points 100 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,288 Points 5k badge 2x thumb
Which API endpoint are you invoking? Could you please post some code?
Photo of Dat Le

Dat Le

  • 160 Points 100 badge 2x thumb
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;
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,288 Points 5k badge 2x thumb
Frankly speaking, I have never tried resending fax. Let me take a look.
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,288 Points 5k badge 2x thumb
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 });
Photo of Dat Le

Dat Le

  • 160 Points 100 badge 2x thumb
Thanks! That worked for me, with the exception of small change

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