Set up your test environment
Symbl.ai provides code samples for many of our API requests. Code samples are usually for curl, Node.js, and Python. We use Replit to provide interactive code samples in your browser. You can also copy our code samples to your local test environment.
If you're new to Symbl.ai and want to try some no-code experiences before getting into the code samples, check out the Get Started Guide and Get Started with Postman.
Test code samples with Replit
Replit is a browser-based IDE that lets you build and share code. This section explains how to sign up for Replit, fork a Symbl.ai code sample, and set up the environment variables needed to run the code.
Most code samples require you to set up one or more environment variables. Symbl.ai uses the Replit environment variables so you can take advantage of the interactive code samples without storing your app ID, app secret, and access tokens in plain text.
Sign up for Replit
To fork and run the Symbl.ai code samples on Replit, you must sign up for an account:
-
Go to https://replit.com/signup and sign up using one of the methods provided.
-
Complete the steps to configure your Replit profile. Replit indicates required fields as you proceed. Most steps can be skipped.
Fork a Symbl.ai code sample
To fork a Symbl.ai code sample:
-
Go to a Symbl.ai code sample. For example, the curl example for authentication.
-
In the upper-right corner of the code sample, select Fork Repl.
You only need to fork a given code sample once. You can find code that you fork or create in the My Repls section of Replit.
Add environment variables for a code sample
To add environment variables for a code sample:
-
Go to your fork of a Symbl.ai code sample.
-
In Replit's left navigation bar, select Secrets (Environment variables) (the padlock icon).
-
In the key box, enter one of the environment variables specified in the code sample. For example,
app_id
oraccess_token
. -
In the value box, enter the value for the corresponding variable. For example:
-
For
app_id
andapp_secret
, your app ID and secret are available at platform.symbl.ai/#/home. -
For
access_token
, you can generate access tokens using Postman or the Authenticate request.
-
-
To save the environment variable, select Add New Secret.
Test code samples with a local environment
Setting up a local test environment can depend on a number of factors, such as your device, operating system, and your familiarity and comfort with a given language or tool. We provide links to some resources for getting started with the different languages and tools used for the code samples.
curl
Curl is a command line tool used to transfer data to or from a server. You can use curl to send requests to the Symbl.ai APIs. The cURL Project provides comprehensive documentation for the tool, including how to install and use curl:
Some methods that you can use to test curl commands:
-
Copy the code sample directly to your command line.
-
Copy the code sample to a shell script and execute the script on the command line.
Node.js
Node.js is an open-source JavaScript runtime environment. The OpenJS Foundation provides extensive documentation for getting started with Node.js:
To test Node.js samples in a local environment, you need to:
-
Install any supporting packages or tools. These will be listed with the code sample.
-
Copy the code sample to a .js file and use
node
to execute that file on the command line.
Python
Python is a widely-used programming language for applications. The Python Software Foundation provides the Python wiki, which includes documentation for getting started with Python:
To test Python samples in a local environment, you need to:
-
Install any supporting packages or tools. These will be listed with the code sample.
-
Copy the code sample to a .py file and use
python
to execute that file on the command line.
Updated about 2 years ago