(AutoIt) VoiceBase -- Retrieve Plain Text Transcript
Retrieves a plain text transcript for a media file.
; This example assumes the Chilkat HTTP API to have been previously unlocked.
; See Global Unlock Sample for sample code.
; Insert your Bearer token here:
Local $sAccessToken = "VOICEBASE_TOKEN"
$oHttp = ObjCreate("Chilkat.Http")
; Add the access (bearer) token to the request, which is a header
; having the following format:
; Authorization: Bearer <userAccessToken>
$oSbAuth = ObjCreate("Chilkat.StringBuilder")
$oSbAuth.Append("Bearer ")
$oSbAuth.Append($sAccessToken)
$oHttp.SetRequestHeader "Authorization",$oSbAuth.GetAsString()
$oSbUrl = ObjCreate("Chilkat.StringBuilder")
$oSbUrl.Append("https://apis.voicebase.com/v2-beta/media/$MEDIA_ID/transcripts/latest")
Local $iReplaceCount = $oSbUrl.Replace("$MEDIA_ID","f9b9bb88-d52c-4960-bcef-d516a9f85594")
$oHttp.Accept = "text/plain"
Local $strText = $oHttp.QuickGetStr($oSbUrl.GetAsString())
If ($oHttp.LastMethodSuccess <> True) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Response status code = " & $oHttp.LastStatus & @CRLF)
ConsoleWrite($strText & @CRLF)
If ($oHttp.LastStatus <> 200) Then
ConsoleWrite("Failed" & @CRLF)
Else
ConsoleWrite("Success" & @CRLF)
EndIf
|