Web Services - Ws - GetDataTableNc

9/5/2019


Sample C# code to use the web service:        

private const string myUserName = "myemail@mydomain.com";
private const string myPassword = "password";
string myUrlPrefix = "https://documentvacuum.com/";

public ActionResult GetDataTableNc()
        {
            string version = "0";
           int pDocId = 911; //make sure this is a valid PDoc id
            HttpClient client = new HttpClient();
            string myUrlSuffix = "api/DocVacDataTableNcApi/GetDataTableNc?version=" + version + "&pDocId=" + pDocId;
            string myUrl = myUrlPrefix + myUrlSuffix;
            var buffer = System.Text.Encoding.ASCII.GetBytes(myUserName + ":" + myPassword);
            var authHeader = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic",
                Convert.ToBase64String(buffer));
            client.DefaultRequestHeaders.Authorization = authHeader;
            client.DefaultRequestHeaders.Accept.Add(new
                System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            try
            {
                var task = client.GetAsync(myUrl);
                HttpStatusCode statusCode = task.Result.StatusCode;
                var output = task.Result.Content.ReadAsStringAsync().Result;
                if (statusCode == HttpStatusCode.OK)
                {
                   string outcome = "Success";
                    List<DocVacDataTableNc> dvdtNcList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DocVacDataTableNc>>(output);
                }
                else if (statusCode == HttpStatusCode.Unauthorized)
                {
                   string outcome = "Bad login credentials or insufficient account permissions";
                }
                else if (statusCode == HttpStatusCode.NotFound)
                {
                   string outcome = "We could not find any dv data tables that match";
                }
                else if (statusCode == HttpStatusCode.InternalServerError)
                {
                   string outcome = "Something else went wrong";
                }
            }
            catch (Exception e)
            {
                string s = e.Message;
            }
            return RedirectToAction("Index");
        }


Other articles:
Billing - DocVacBasic & DocVacGold
Web Services - Ws - GetPDocPageClassificationNc
Web Services - Usage Charges
Postman
Web Services - Class - PDocDetailNc
Web Services - Class - PDocPageNc
Web Services - Class - PDocRowClassificationNc
Web Services - Class - PDocRowXmlNc
Web Services - Class - PdrxDataTypeNc
Web Services - Class - PdrxstnMappingNc
more