Using curl

Perform the following steps to set up curl and create a project for Oracle Primavera using the Primavera Data Service.

Step 1: Obtain Account Information

Contact your account administrator to obtain the account credentials required to manage workspaces using the data service. You will need:

  • A username and password for Oracle Primavera that has the application administrator privilege
  • The URL of your Oracle Primavera Data Service RESTful endpoints

Step 2: Install curl

The examples within this topic demonstrate how to access the data service using the curl command-line tool.

To connect to the data service, you must install a version of curl that supports SSL. When you connect to the data service, you must provide an SSL certificate authority (CA) certificate file or bundle to authenticate against the Verisign CA certificate. See also:

To install curl on a Windows 64-bit system:

  1. In your browser, navigate to the curl home page and select Download.
  2. On the curl Releases and Downloads page, locate the SSL-enabled version of the curl software for 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 cacert.pem SSL CA certificate bundle in the folder where you installed curl.
  4. Open the command-line, 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=cacert.pem
    		

You are now ready to send requests to the Oracle Primavera Data Service using curl.

Step 3: Run a Query

To run a query using the data service, send an HTTP POST request to the /runquery endpoint. Your POST request must include additional JSON data that specifies the table names, columns and criteria of the query.

The following example uses a JSON file named query.json to query TASK_ID, TASK_NAME, TASK_TYPE, STATUS_CODE, ACT_START_DATE, ACT_END_DATE columns on TASK table, with criteria PROJ_ID=4603 and REMAIN_WORK_QTY >= 116.

{
        "name": "My Activities",
        "sinceDate": null,
          "tables": [
          {
            "tableName": "TASK",
            "columns": [
              "TASK_ID",
              "TASK_NAME",
              "TASK_TYPE",
              "STATUS_CODE",
              "ACT_START_DATE",
              "ACT_END_DATE"
            ],
            "condition": {
              "operator": "AND",
              "conditions": [
                {
                  "columnName": "REMAIN_WORK_QTY",
                  "operator": "GREATER_THAN_OR_EQUALS",
                  "value1": "116",
                  "value2": null
                },
                {
                  "columnName": "PROJ_ID",
                  "operator": "EQUALS",
                  "value1": "4603",
                  "value2": null
                }
              ]
            }
          }
        ]
      }