Web Services - Ws - GetPDocDetailNcLatest

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 GetPDocDetailNcLatest()

{
    string version = "0";
    HttpClient client = new HttpClient();
    string myUrlSuffix = "api/PDocDetailNcApi/GetPDocDetailNcLatest?version=" + version;
    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<PDocDetailNc> pddNcList =
             Newtonsoft.Json.JsonConvert.DeserializeObject<List<PDocDetailNc>>(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 pDocDetails";
        }

        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