Use cURL
The examples within this document use cURL to demonstrate how to access the OIPA REST APIs.
Installing 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 Verisign CA certificate.
The following procedure demonstrates how to install cURL on a Windows 64 bit system.
-
In your browser, navigate to the cURL home page at http://curl.haxx.se, and click Download in the left navigation menu.
-
On the cURL Releases and Downloads page, locate the SSL-enabled version of the cURL software that corresponds to your operating system, click the link to download the ZIP file, and install the software.
-
Navigate to the cURL CA Certs page at http://curl.haxx.se/docs/caextract.html, and download the ca-bundle.crt SSL CA certificate bundle in the folder where you installed cURL.
-
Open a command window, navigate to the directory where you installed cURL, and set the cURL environment variable,
CURL_CA_BUNDLE
, to the location of an SSL certificate authority (CA) certificate bundle. For example:C:\curl> set CURL_CA_BUNDLE=ca-bundle.crt.
You are now ready to send requests to OIPA using cURL.
cURL Access
To use cURL to access the OIPA REST APIs:
-
Install cURL, as described above.
-
In a command window, set the cURL environment variable, CURL_CA_BUNDLE, to the location of your local CA certificate bundle. For information about CA certificate verification using cURL, see: http://curl.haxx.se/docs/sslcerts.html.
-
Invoke cURL and specify one or more of the command-line options defined in the following table, as required, to direct its execution.
cURL Option | Description |
---|---|
|
Identifies the request document, in JSON format, on the local machine. |
|
Identifies form data, in JSON format, on the local machine. |
|
Defines one or both of the following:
|
|
Displays response header information. |
|
Specifies the user name and password for the OIPA account. |
|
Indicates the type of request (for example, GET, POST, and so on). |
For example:
curl -X DELETE \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "userName: username" \ -H "password: password" \ -L "http://host:port/PASJava/service/caches"