Use cURL
The examples in this document use cURL to demonstrate how to access the REST API for AI Services.
Task 1: Install cURL
To connect securely to the server, you must install a version of cURL that supports SSL and provide an SSL certificate authority (CA) certificate file or bundle to authenticate against the CA certificate store, such as Verisign.
To install cURL on a Windows 64-bit system:
-
In your browser, navigate to the cURL Releases and Downloads page at https://curl.se/download.html.
-
Locate the version of the cURL software that corresponds to your operating system, click the link to download the ZIP file, and then install the software.
-
Go to the cURL CA Certs page at https://curl.se/docs/caextract.html and then download the ca-bundle.pem SSL CA certificate bundle to the folder in which you installed cURL.
Task 2: Set Environment Variable for cURL
Set the CURL_CA_BUNDLE environment variable to the location of your local CA certificate bundle. For example, you can set the environment variable in a command window using the following command:
set CURL_CA_BUNDLE=ca-bundle.pem
For information about CA certificate verification using cURL, see https://curl.se/docs/sslcerts.html.
Task 3: Start cURL
Start cURL and specify one or more of the command-line options defined in the following table:
| cURL Option | Description |
|---|---|
|
Identifies the file containing the
request body in JSON format on the local machine. Alternatively, you
can pass the request body with -d
"{id=5,status='OK'}".
|
|
Identifies from data, in JSON format, on the local machine. |
|
Defines one or more of the following:
|
|
Displays header information in the response. |
|
Indicates the type of request method (for example, GET or POST). |