Sample code for 30+ languages & platforms
C#

Duo Auth API - Ping

See more Duo Auth MFA Examples

The /ping endpoint acts as a "liveness check" that can be called to verify that Duo is up before trying to call other Auth API endpoints.

Chilkat C# Downloads

C#
bool success = false;

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Chilkat.Http http = new Chilkat.Http();

http.Accept = "application/json";

// Use your own hostname here:
string url = "https://api-a03782e1.duosecurity.com/auth/v2/ping";

string jsonStr = http.QuickGetStr(url);
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Debug.WriteLine("status code = " + Convert.ToString(http.LastStatus));
Debug.WriteLine(jsonStr);

// Sample successful output:

// status code = 200
// {"response": {"time": 1632358295}, "stat": "OK"