(C) Duo Auth API - Ping
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.
For more information, see https://duo.com/docs/authapi#/ping
#include <C_CkHttp.h>
void ChilkatSample(void)
{
HCkHttp http;
const char *url;
const char *jsonStr;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttp_Create();
CkHttp_putAccept(http,"application/json");
// Use your own hostname here:
url = "https://api-a03782e1.duosecurity.com/auth/v2/ping";
jsonStr = CkHttp_quickGetStr(http,url);
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
return;
}
printf("status code = %d\n",CkHttp_getLastStatus(http));
printf("%s\n",jsonStr);
// Sample successful output:
// status code = 200
// {"response": {"time": 1632358295}, "stat": "OK"
CkHttp_Dispose(http);
}
|