Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Node.js Web API Examples

Primary Categories

Facebook
GeoOp
Jira
PayPal
Peoplevox
QuickBooks

Shopify
Stripe
SugarCRM
Twitter
VoiceBase
Walmart
Xero
eBay
effectconnect

 

 

 

(Node.js) VoiceBase -- Retrieve Plain Text Transcript

Retrieves a plain text transcript for a media file.

Install Chilkat for Node.js and Electron using npm at

Chilkat npm packages for Node.js

Chilkat npm packages for Electron

on Windows, Linux, MacOSX, and ARM

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node11-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node11-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node11-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node11-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node11-linux64');
    }
} else if (os.platform() == 'darwin') {
    var chilkat = require('@chilkat/ck-node11-macosx');
}

function chilkatExample() {

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

    // Insert your Bearer token here:
    var accessToken = "VOICEBASE_TOKEN";

    var http = new chilkat.Http();

    // Add the access (bearer) token to the request, which is a header
    // having the following format:
    // Authorization: Bearer <userAccessToken>
    var sbAuth = new chilkat.StringBuilder();
    sbAuth.Append("Bearer ");
    sbAuth.Append(accessToken);
    http.SetRequestHeader("Authorization",sbAuth.GetAsString());

    var sbUrl = new chilkat.StringBuilder();
    sbUrl.Append("https://apis.voicebase.com/v2-beta/media/$MEDIA_ID/transcripts/latest");
    var replaceCount = sbUrl.Replace("$MEDIA_ID","f9b9bb88-d52c-4960-bcef-d516a9f85594");

    http.Accept = "text/plain";

    var strText = http.QuickGetStr(sbUrl.GetAsString());
    if (http.LastMethodSuccess !== true) {
        console.log(http.LastErrorText);
        return;
    }

    console.log("Response status code = " + http.LastStatus);
    console.log(strText);

    if (http.LastStatus !== 200) {
        console.log("Failed");
    }
    else {
        console.log("Success");
    }


}

chilkatExample();

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.