(DataFlex) 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
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
String sUrl
String sJsonStr
String sTemp1
Integer iTemp1
Boolean bTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Set ComAccept Of hoHttp To "application/json"
// Use your own hostname here:
Move "https://api-a03782e1.duosecurity.com/auth/v2/ping" To sUrl
Get ComQuickGetStr Of hoHttp sUrl To sJsonStr
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComLastStatus Of hoHttp To iTemp1
Showln "status code = " iTemp1
Showln sJsonStr
// Sample successful output:
// status code = 200
// {"response": {"time": 1632358295}, "stat": "OK"
End_Procedure
|