eDocs API request schema

tcasciano
edited May 13, 2021 in AppWorks #1

Where can I find the schema for making requests with the eDocs API? For example, on the API reference page for eDocs API, the POST method for the 'documents' endpoint just shows that the required POST data is 'data'. It doesn't show what the format for that data.

Tagged:

Comments

  • Are there any developers out there using the eDocs REST API?

  • CraigWoods
    edited August 1, 2019 #3

    Hi,

    Apologies that we missed your question. The eDOCS forums have not yet been migrated over to our new forums system and that is where this type of question would be best placed.

    The data response should be the metadata that will be used in the profile form for the given document.

    Here is a .NET example from my testing project:

    string profileInformation = "{\"DOCNAME\":\"" + "REST API dotNet Test" + "\"," +
        "\"AUTHOR_ID\":\"" + _username + "\"," +
        "\"CLIENT_ID\":\"DEFAULT\",\"MATTER_ID\":\"DEFAULT\"," +
        "\"TYPE_ID\":\"DEFAULT\",\"APP_ID\":\"MS OUTLOOK\"," +
        "\"FULLTEXT\":\"Y\",\"TYPIST_ID\":\"" + _username + "\"," +
        "" +
        "\"_restapi\":" +
        "{\"form_name\":\"LEGALPROF\"}}";
    

    Full C# function utilising the documents endpoint:

    public static async void UploadDocument(string filePath)
    {
        string uri = $"{_server}/edocsapi/v1.0/documents?library={_library}";
        string profileInformation = "{\"DOCNAME\":\"" + "REST API dotNet Test" + "\"," +
            "\"AUTHOR_ID\":\"" + _username + "\"," +
            "\"CLIENT_ID\":\"DEFAULT\",\"MATTER_ID\":\"DEFAULT\"," +
            "\"TYPE_ID\":\"DEFAULT\",\"APP_ID\":\"MS OUTLOOK\"," +
            "\"FULLTEXT\":\"Y\",\"TYPIST_ID\":\"" + _username + "\"," +
            "" +
            "\"_restapi\":" +
            "{\"form_name\":\"LEGALPROF\"}}";
        try
        {
            FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
            StreamContent body = new StreamContent(stream);
            body.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
            MultipartFormDataContent content = new MultipartFormDataContent();
            StringContent profile = new StringContent(profileInformation, System.Text.Encoding.UTF8, "application/json");
            content.Add(body, "file", String.Format("{0}", filePath.Substring(filePath.LastIndexOf('\\') + 1)));
            content.Add(profile, "data");
            HttpClientHandler clientHandler = new HttpClientHandler()
            {
                CookieContainer = GetCookies()
            };
            HttpClient httpClient = new HttpClient(clientHandler);
            HttpResponseMessage responseMessage = await httpClient.PostAsync(uri, content);
            MessageBox.Show(await responseMessage.Content.ReadAsStringAsync()); // docnumber returned here in 16.5 rest api.
        }
        catch (WebException ex)
        {
            System.Windows.Forms.MessageBox.Show(ex.Message);
            string dmError = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
            System.Windows.Forms.MessageBox.Show(dmError);
        }
    }
    

    Hope this helps!

    Craig Woods
    Lead Technical Support Specialist | eDOCS
    Open Text Corporation United Kingdom

  • Craig,

    Thank you for the response. This will help us get started. We are having trouble trying to find all of the information we need to develop our application. Can you point me too additional documentation and/or sample apps? We have a python script (Demo.py) that allows us to learn about the eDocs API but there are no details/description on what each element in the request body actually are other than "data" and "_restapi". Also, do you know when the eDocs forums will be migrated and/or if we can get access to the forum you mentioned?

    Regards,
    Tony

  • Craig,

    Thank you. I will take a look at the examples you described. Can you tell me what the Swagger UI page is and how it is accessed?

  • I have a feeling that you have already seen it, as you referred to the "API reference page", but here it is in case you have not: https://developer.opentext.com/webaccess/#url=/awd/resources/apis/edocs-rest-api-16-3-1&tab=501

    Craig Woods
    Lead Technical Support Specialist | eDOCS
    Open Text Corporation United Kingdom