Skip to content

aramix/SpeechpadNodeAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APILite

NodeJS port of https://github.com/Speechpad/APILite wrapping the Speechpad API functionality.

Installation

$ npm install speechpad

Config

Creating configuration files for development and production

This package depends on the config package for configuration.

To create a basic configuration do the following

$ mkdir config
$ vi config/default.json
{
  "rest_uri": "http://dev.speechpad.com/services",
  "access_key": "sandbox_key",
  "secret_key": "sandbox_secret"
}

Edit config overrides for production deployment:

 $ vi config/production.json
{
  "rest_uri": "https://www.speechpad.com/services",
  "access_key": "production_key",
  "secret_key": "production_secret"
}

Usage Examples

Instantiating the class

const APILite = require('speechpad');
// no further configuration is needed

Making a test call

// see examples/test.js

const params = {
  'service_name': 'account',
  'service_version': '1.0.0',
  'format': 'json',
  'method': 'get',
  'operation': 'test',
  'value': '123'
};

APILite.call(params).then((res) => {
  console.log(res.data);
});

Using the Pre-made Example Scripts

There are a handful of example scripts inside the package directory (node_modules/speechpad/examples) provided to illustrate some basic usage of the Speechpad API.

All examples below assume:

  • you have valid keys in config/default.json (for sandbox) or config/production.json (for production)
  • are running the scripts on a web server
  • are making requests to the examples provided

NOTE: We recommend running the examples against the sandbox endpoint only. Any usage against the production endpoint may result in your account being invoiced or charged.

test

$ node examples/test

add_media_url

$ node examples/add_media_url "https://www.speechpad.com/is_a.mp3"

(Replace https://www.speechpad.com/is_a.mp3 with a public URL to your own media.)

transcription_status

$ node examples/transcription_status "12345,12346"

(Replace "12345,12346" with the ID (or comma-separated list of IDs) of the media you are checking.)

get_transcript

$ node examples/get_transcription "12345"

(Replace 12345 with single media ID.)

About

Speechpad APILite for Node

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published