Using cURL to Test Your Send Requests

The command-line tool cURL (https://curl.haxx.se) uses a URL format to transfer data. Use cURL to test the format that you use for your REST API requests. It is available in most environments.

cURL Examples

The following examples use cURL.

Retrieving a Resource

Command

The example command is for a Cloud environment.

curl -u {username}:{password} -X GET -H "Accept:application/json"
				https://{host}/{tenant}/dev01/wacs/rest/apis/asset/work/workActivity/{activityId}

Installing cURL

cURL is typically available by default on most UNIX-like hosts.

To install cURL:

  1. In your browser, navigate to the cURL home page at http://curl.haxx.se.

  2. In the navigation menu, click Download.

  3. On the cURL Releases and Downloads page, locate the version of the cURL that is enabled for SSL, and that supports your operating system, click the link to download the ZIP file, and then extract the executable to a folder that you choose.

  4. Navigate to http://curl.haxx.se/docs/caextract.html and then download the certificate bundle ca-bundle.crt for SSL CA.

    Download it into the folder where you installed cURL.

  5. Open a command window, and then navigate to the directory where you installed cURL.

  6. Set the cURL environment variable, CURL_CA_BUNDLE, to the location where the certificate bundle resides for an SSL certificate authority (CA).

    For example, on a Windows system, you enter the following command: C:\curl> set CURL_CA_BUNDLE=ca-bundle.crt

You can now use cURL to send a request to the REST API.