Legacy Dev Forum Posts

 View Only

Sign Up

  • 1.  Fax via OAuth App

    Posted 06-05-2025 18:04

    Jgalati | 2016-09-30 16:51:58 UTC | #1

    Hey,

    We've Created a role with the Converstation > Fax > Send Permission Assigned the Role to our OAuth2 Application ID

    Code to send a Fax Below:

    ININ.PureCloudApi.Client.Configuration.Default.AccessToken = GetPurecloudAccessToken(); ConversationsApi faxApi = new ConversationsApi(); FaxSendRequest bodyFax = new FaxSendRequest(Addresses: new List<string>() { "xxxxxxxxxx" }); bodyFax.ContentType = FaxSendRequest.ContentTypeEnum.Applicationpdf; bodyFax.Name = "Test_Fax.pdf"; bodyFax.TimeZoneOffsetMinutes = 0;

    var result = faxApi.PostFaxes(bodyFax);

    RestClient restClient = new RestClient(result.UploadDestinationUri); var request = new RestRequest(Method.POST); request.AlwaysMultipartFormData = true; request.AddParameter("Content-Type", "application/pdf", ParameterType.RequestBody); request.AddParameter("name", "TestFax.pdf"); request.AddFile("filename", @"C:\FaxeDocuments\TestFax.pdf", "application/pdf");

    IRestResponse response = restClient.Execute(request);

    Content = "{\"correlationId\":\"2b8d0150-22ac-47e8-9cd9-01e2a3cb14f8\"}"

    We get a correlationID and everything seems successful but the fax never goes through. Are we missing any extra permissions ? And is there anyway to prevent the faxed document from being saved to Documents Folder ?

    Thanks, Joe


    KevinGlinski | 2016-09-30 17:15:33 UTC | #2

    when was this request made and which environment? I don't see that correlation id in our logs. is that correlation id from the restClient.execute?

    Do you have one from the PostFaxes response?


    KevinGlinski | 2016-09-30 17:42:54 UTC | #3

    You can send faxes from the UI correct? and if you get your user's conversations, does the fax show up in the conversation list?


    KevinGlinski | 2016-09-30 17:58:11 UTC | #4

    Your problem is likely that you are trying to use the client credentials grant. Faxes need a user to send on behalf of and client credentials operates without a user.


    Jgalati | 2016-09-30 18:26:53 UTC | #5

    when was this request made and which environment?

    standalone c# application

    I don't see that correlation id in our logs. is that correlation id from the restClient.execute?

    It was the response from the restClient.Execute(request);

    Do you have one from the PostFaxes response?

    Sure here is a new pair Post Fax id: c5b83c43-f910-41bd-b5af-8e8f10d174bc restClient.Execute : d58e2064-4268-458a-b211-eb983306a9c9

    You can send faxes from the UI correct? and if you get your user's conversations, does the fax show up in the conversation list?

    Yes works fine from my account.

    Your problem is likely that you are trying to use the client credentials grant. Faxes need a user to send on behalf of and client credentials operates without a user.

    Ok so it's impossible to send faxes from an application only account ?


    KevinGlinski | 2016-09-30 18:28:23 UTC | #6

    Jgalati, post:5, topic:459
    Ok so it's impossible to send faxes from an application only account ?

    Correct, you would have to use implicit or auth code grants


    system | 2017-08-28 19:27:41 UTC | #7


    This post was migrated from the old Developer Forum.

    ref: 459