• RE: C# Connection to REST API

    Hello Joe,

    you were right, I used .Net Framework and everything worked perfectly!

    Thank you for your support and have a nice day!


    Best regards Vural
  • RE: C# Connection to REST API

    Hello Joe,

    I have a second Problem, now Im trying to use Docuwares Classes from the link you posted. Via Nuget i installed DocuWarePlatformApi. I tried to connect to the Service  with the following code

    using DocuWare.Platform.ServerClient;
    using System;


    namespace PRG_DocuWare_Use_Own_API
    {
        class Program
        {
            static void Main(string[] args)
            {

                Console.WriteLine("Hello World!");
                var conn = ServiceConnection.Create(new Uri("https://studenthsnr.docuware.cloud/DocuWare/Platform"), "username", "password");
                  
            }
        }
    }

    I get the Following error: 

    System.IO.FileLoadException: "Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=............'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)"

    Maybe you have a solution.


    Best regards

    Vural
  • RE: C# Connection to REST API

    Hello Joe,

    first of all thank you verry much for the quick response!!! Your support is awesome!

    Im getting the Error when Im ensuring the Status Code in the Line:

    var responseBody2 = await response2.Content.ReadAsStringAsync()

    In our study  the use case is to use native C# an not depend on third party Software. I updated my Code and now im getting the following Error.

    {StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:{  Date: Fri, 07 Feb 2020 08:50:29 GMT  Connection: keep-alive  Cache-Control: s-maxage=0, private  Server: Microsoft-IIS/10.0  Server: curious  Server: .  Server: .  Server: .  Strict-Transport-Security: max-age=31536000;includeSubDomains  Content-Security-Policy: script-src https://*.docuware.cloud https://saas.docuware.com https://go.docuware.com https://widget.surveymonkey.com https://secure.surveymonkey.com 'self' blob: dwcloudstatic.azureedge.net cdnjs.cloudflare.com ajax.aspnetcdn.com ajax.googleapis.com *.msecnd.net https://*.userlane.com use.fontawesome.com 'unsafe-inline' 'unsafe-eval'  Expect-CT: max-age=0, report-uri='https://dw-csp-reporter.azurewebsites.net/'  X-Xss-Protection: 1; mode=block  Referrer-Policy: strict-origin  X-Content-Type-Options: nosniff  X-Robots-Tag: noindex, nofollow  x-served-by: pf2300003Y  Content-Type: application/xml; charset=utf-8  Content-Length: 594}}

    I will try to do as you said for now. First upload it, then index it using a separate POST.

    Thank you for everything the foundation of yours is really awesome!

  • C# Connection to REST API

    Hello colleagues,

    for an university project im developing a C# class which connects to the Rest API of Docuware (Cloud Plattform). I developed a Post-Reqeust to get the access to the Rest API. It worked perfectly. Next I developed a Get-Reqeust to get the first 5 Documents in the File Cabinet. This also works perfectly. My biggest Problem is to "Upload  a file and create a document at the same time". First I used Postman (with the Postman package which is provided by you) to test the command, than I tried it in C# Consol Programm. In Postman everything works perfectly but in C# I get the Error:


    <?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="/DocuWare/Platform/Content/errors.xslt"?><s:Error Uri="http://studenthsnr.docuware.cloud/DocuWare/Platform/FileCabinets/9f3d1ebb-618d-4c8e-8af3-6067ca0a3a88/Documents" Method="POST" StatusCode="500" Status="Internal Server Error" xmlns:s="http://dev.docuware.com/schema/public/services"><s:ShowException>false</s:ShowException><s:Message>Value cannot be null.
    Parameter name: input</s:Message><s:Exception>ArgumentNullException: Value cannot be null.
    Parameter name: input</s:Exception></s:Error>


    This ist my Codding:

    var xmlStream = new FileStream(xmlFilePath, FileMode.Open);
                var docStream = new FileStream(docFilePath, FileMode.Open);


                HttpContent xmlFileStreamContent = new StreamContent(xmlStream);
                HttpContent docFileStreamContent = new StreamContent(docStream);

                var formData = new MultipartFormDataContent();


                formData.Add(xmlFileStreamContent, "document");//xmlData
                formData.Add(docFileStreamContent, "file[]");//actual Document

                var response2 = await client.PostAsync("https://{Plattform}/FileCabinets/{Cabinet Id}/Documents", formData);
                var responseBody2 = await response2.Content.ReadAsStringAsync();
                var responseHeader2 = response2.EnsureSuccessStatusCode();
                Console.WriteLine(responseBody2);

    The Authorization is not the Problem, I checked it.

    I would be happy if you can provide a solution.


    Best regards Vural