Concepts: Testing Tools for Brightcove APIs

In this topic, you will learn about tools that Brightcove Learning Services provides to help you test and learn the Brightcove RESTful APIs.

List of tools

The following tools are discussed in this guide:

API Testing Tools
Testing Tool APIs
api-tester.sh Any API that uses Brightcove OAuth for authenticating requests
online tester Any API that uses Brightcove OAuth for authenticating requests
Insomnia Any REST API, regardless of authentication method
Postman Any REST API, regardless of authentication method
  • A shell script that can be run from the command line if you are working on MacOS or some other UNIX or LINUX system, or if you have cURL installed on a Windows system
  • An online testing tool that should work in any browser
  • A guide to using the popular Postman REST API Tester

The shell script (cURL)

The command-line tool is a shell script called api-tester.sh to get access tokens and make the API calls. The api-tester script uses cURL to make http calls. cURL is built in on Mac MacOS and all Unix/Linux systems. To get cURL on Windows, see Setting up cURL. Then download the api-tester.sh script

You can see the full code for the shell script at Getting Access Tokens.

Running the shell script

After you download the shell script, unzip it wherever you like, and then go to a command line in the same folder. To run the script, type:

	bash api-tester.sh

Each time you run the script, it will prompt you for 5 variables:

  • Client ID (see the section below on obtaining client credentials)
  • Client Secret (see the section below on obtaining client credentials)
  • The full API call (example: https://cms.api.brightcove.com/v1/accounts/12345678/videos
  • The request verb - one of the following: GET | POST | PATCH | PUT | DELETE (GET is the default)
  • Request data - used for POST, PATCH, and PUT; for GET and DELETE requests, you will leave this blank and just press return

The command-line tool will return the same response as the online tool - however, it also echoes the full response, which allows you to see the headers and more information if the request fails for some reason. It also echos the raw JSON for the response as well as a pretty-printed version.

The online tool

The online testing tool can be found here. Like the command-line tool, it asks you for:

  • A client id
  • A client secret
  • The full API request URL
  • The request type
  • The JSON data to be submitted, if any

Insomnia

See the step-by-step guide to making API requests using Insomnia.

Postman

See the step-by-step guide to making API requests using Postman.

Obtain credentials

To use the Brightcove APIs you will need proper client credentials, consisting of a client_id and client_secret. See the OAuth Overview to get a better understanding of the client credential flow.

To get a client_id and client_secret, you will need to go to the OAuth UI and register an app:

You can also get your credentials via CURL or Postman - see: