Concepts: Setting up cURL

In this topic, you will learn about cURL, a tool useful for testing and making API requests. cURL is a command line tool for making HTTP requests. We use cURL in a shell script for testing Brightcove API calls. If you are on Mac MacOS or any Unix/Linux system, you already have cURL. If you are on Windows, see instructions below for getting cURL.

Windows

If you have Windows, you can download and install cURL as follows.

Installing cURL

  1. In Windows, create a new folder called curl in your C: drive.

    C:curl

  2. Go to https://cygwin.com/install.html follow the instructions there, choosing the 32-bit or 64-bit installer according to the system you have. During the install you will be prompted for packages to install. Open the Net package, then check the curl option and then finish the installation.

Test your setup

To run cURL commands, you just type curl (with appropriate flags for the request you want to make) at the Terminal or DOS prompt, and then pressing Return. To make sure cURL is correctly installed, open a Terminal or DOS window, type curl at the prompt, and press Return. You should see a message like this:

curl: try 'curl --help' or 'curl --manual' for more information

Sending data

If you need to send data with the API request (as in a POST or PATCH request, for example), there are several ways to do it. You can include the data inline or in a separate file. Here is a Player Management API example submitting the data as a separate JSON file:

curl --request POST
    --url https://players.api.brightcove.com/v2/accounts/57838016001/players
    --header 'authorization: Bearer YOUR_ACCESS_TOKEN_HERE'
    --header 'content-type: application/json'
    --data <player_data/player_config.json