Projection Support

You can filter the JSON data returned by the Oracle Primavera Cloud API. Some JSON responses are large and contain data that you may want to filter out of the response. For example, you may want to request only the project IDs of projects assigned a particular code value. Rather than sift through the large amount of project data returned by the project/codeType/{typeId}/codeValue/{code} endpoint, you can use the select header to ensure the JSON response only contains the IDs of the requested projects.

Exceptions

  • Projection will not work on count, next, and previous fields of the paginated response. If applied, projection will be ignored on these fields. This limitation applies to auto-pagination as well.

Examples

Projections can be performed by adding 'select' header. Use comma-separated values for specifying multiple fields that need to be returned in an API request.

In all the below examples, <SERVER_URL> refers to the URL on which the application is deployed. For example, primavera.oraclecloud.com.

Without using Projections

The following URL:

https://<SERVER_URL>/api/restapi/project/workspace/10001
		

might return JSON output similar to the following:

[
    {
        "parentProject": 10001,
        "workspaceId": 20001,
        "status": "ACTIVE",
        "configuredFields": [
            {
                "projectId": 1001,
                "projectConfiguredFieldValueId": 18001,
                "columnLabel": "Estimated Cost",
                "columnDefinitionId": 1001,
                "numberValue": 100,
                "updateDate": "2022-01-01T00:00:00"
            },
            {
                "projectId": 1001,
                "projectConfiguredFieldValueId": 18002,
                "columnLabel": "Current Status",
                "columnDefinitionId": 1002,
                "textValue": "Approved",
                "updateDate": "2022-01-01T00:00:00"
            }
        ],
        "projectId": 1001,
        "projectCode": "Delta Project",
        "planStartDate": "2022-01-01T00:00:00.+0000",
        "planEndDate": "2022-02-01T16:00:00.+0000",
        "projectName": "Delta Project",
        "isTemplateFlag": false,
        "workspaceCode": "Company",
        "projectTimeZone": "GREENWICH_MEAN_TIME",
        "calendarId": 0,
        "managerId": 10001,
        "projectFinancial": {
            "projectId": 1001,
            "actualCost": 100,
            "plannedBudgetUndistributed": 0,
            "plannedBudgetUndistributedProject": 0,
            "forecastCostUndistributed": 0,
            "forecastCostUndistributedProject": 0,
            "benefitsUndistributed": 0,
            "benefitsUndistributedProject": 0
        },
        "codeValuesProject": [],
        "projectCashFlows": [],
        "updateDate": "2022-01-01T00:00:00"
    },
    {
        "parentProject": 10001,
        "workspaceId": 20001,
        "status": "ACTIVE",
        "configuredFields": [
            {
                "projectId": 1002,
                "projectConfiguredFieldValueId": 18003,
                "columnLabel": "Estimated Cost",
                "columnDefinitionId": 1001,
                "numberValue": 200,
                "updateDate": "2022-01-01T00:00:00"
            },
            {
                "projectId": 1002,
                "projectConfiguredFieldValueId": 18004,
                "columnLabel": "Current Status",
                "columnDefinitionId": 1002,
                "textValue": "Pending",
                "updateDate": "2022-01-01T00:00:00"
            }
        ],
        "projectId": 1002,
        "projectCode": "Engineering",
        "planStartDate": "2022-01-01T00:00:00.+0000",
        "planEndDate": "2022-02-01T16:00:00.+0000",
        "projectName": "Engineering",
        "isTemplateFlag": false,
        "workspaceCode": "Company",
        "projectTimeZone": "GREENWICH_MEAN_TIME",
        "calendarId": 0,
        "managerId": 10001,
        "codeValuesProject": [],
        "projectCashFlows": [],
        "updateDate": "2022-01-01T00:00:00"
    }
]

Projections using a Single Field in the Header

The following URL:

https://<SERVER_URL>/api/restapi/project/workspace/10001
		

with the HTTP Header as:

select: projectCode

might return JSON output similar to the following:

 
[
  {
    "projectCode": "Construction"
  },
  {
    "projectCode": "Engineering"
  }
]

Projections using Multiple Fields in the Query

The following URL:

https://<SERVER_URL>/api/restapi/project/workspace/10001
		

with HTTP header as:

select: projectCode,projectId

might return JSON output similar to the following:

[
  {
    "projectCode": "Construction",
    "projectId": 1001
  },
  {
    "projectCode": "Engineering",
    "projectId": 1002
  }
]

Projections using Nested Fields

Some fields of Primavera Cloud JSON responses contain nested fields. You can target the nested fields with the select header by specifying the nested entity's root field name followed by a comma-separated list of the nested entity field names in parentheses.

For example, in a project, to select:

  • the nested fields numberValue, textValue, columnDefinitionId under a nested entity with the root field name configuredFields,
  • and the nested field actualCost under a nested entity with the root field name projectFinancial,
  • and other fields, such as projectCode, projectId, workspaceId available directly under ApiEntityProject ,

send a request the following URL:

https://<SERVER_URL>/api/restapi/project/workspace/10001

with HTTP header as :

select:projectCode,projectId,configuredFields{numberValue,textValue,columnDefinitionId},projectFinancial{actualCost},workspaceId

This might return a JSON output similar to the following:

[
    {
        "projectId": 1001,
        "configuredFields": [
            {
                "numberValue": 100,
                "columnDefinitionId": 1001
            },
            {
                "textValue": "Approved",
                "columnDefinitionId": 1002
            }
        ],
        "projectCode": "Construction",
        "projectFinancial": {
            "actualCost": 100
        },
        "workspaceId": 10001
    },
    {
        "projectId": 1002,
        "configuredFields": [
            {
                "numberValue": 200,
                "columnDefinitionId": 1001
            },
            {
                "textValue": "Pending",
                "columnDefinitionId": 1002
            }
        ],
        "projectCode": "Engineering",
        "workspaceId": 10001
    }
]