Use cURL

The examples in this document use cURL to to access the Oracle Visual Builder Studio REST API.

Task 1: Install cURL

To connect to the server securely, you must install a version of cURL that supports SSL and provides an SSL certificate authority (CA) certificate file or bundle to authenticate against the Verisign CA certificate. For more information about authentication, see Authenticate.

The following procedure demonstrates how to install cURL on a Windows 64-bit system.

  1. In your browser, navigate to the cURL home page at http://curl.haxx.se and click Download in the left navigation menu.

  2. 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.

  3. 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.

  4. 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 using cURL.

Task 2: Set Environment Variable for cURL

In a command window, set the cURL environment variable, CURL_CA_BUNDLE, to the location of your local CA certificate bundle. For example:

C:\curl> set CURL_CA_BUNDLE=ca-bundle.crt

For information about CA certificate verification using cURL, see http://curl.haxx.se/docs/sslcerts.html.

Task 3: Invoke cURL

Invoke cURL, then specify one or more command-line options shown in the following table to direct its execution, and include the full URL to the end point.

Select Your cURL Options

cURL Option Description

-d, --data @file.json

Specifies the request body, or data, either directly or by referring to a JSON file on the local machine.

-F, --form @file.json

Specifies form data, either directly or by referring to a JSON file on the local machine.

-H

Defines a request header.

-i

Displays response header information.

-u, --user

Specifies the user name and password for the Oracle Java Cloud Service account.

-X

Indicates the type of request (for example, GET, POST, and so on).

Figure Out the Full URL to the End Point

For Issues, the URL is composed this way:

https://server/org-id/rest/org-id_project-id/issues/v3/issues

The first two parts of the URL (server/org-id) are quite easy to get. You can just copy them from the project's URL in your browser.

The org-id_project-id part of the URL is something you can get by going to your project's Project Home page, clicking on the Repositories tab, and looking at the details of your Maven or Git repository URL. Look for the part before /maven/ or /scm/repository-name.git at the end. Some projects may also include a numeric value appended to the project name, something like org-id_project-name_27893.

Note:

If you're the project owner, you can select Project Administration in the navigator, click the Properties tile, then look in the Identifier field to find the org-id_project-id part of the URL.

For Builds, you can compose the URL in a similar manner, but use /v1/jobs for jobs, /v1/pipelines for pipelines, or /v1/yaml for YAML validation and returning YAML definitions for jobs or pipelines.

Example

Let's put it all together with an example. The following cURL command shows all jobs that have a job identifier of 15 and are associated with the A_Job_Parameters build job, then lists when each job ran:

curl -i -X GET -u alex.admin https://mycompany.com/myorg/rest/myorg_myproject-21-10-0_1234/cibuild/v1/jobs/A_Job_Parameters/builds?zone=PST
Enter host password for user 'alex.admin':
 jobs/JOBID-15/builds/9 [Dec 31, 2019 03:59 PM PST]
 jobs/JOBID-15/builds/8 [Feb 27, 2020 12:24 PM PST]
 jobs/JOBID-15/builds/7 [Jan 27, 2020 10:21 AM PST]
 jobs/JOBID-15/builds/6 [Dec 31, 2019 03:59 PM PST]
 jobs/JOBID-15/builds/5 [Jan 24, 2020 02:25 PM PST]
 jobs/JOBID-15/builds/4 [Dec 31, 2019 03:59 PM PST]
 jobs/JOBID-15/builds/3 [Jan 21, 2020 09:27 AM PST]
 jobs/JOBID-15/builds/2 [Jan 16, 2020 09:59 AM PST]
 jobs/JOBID-15/builds/1 [Jan 15, 2020 11:13 AM PST]