Primavera Data Service Introduction

Primavera Data Service exposes a set of endpoints that enable you to extract data from the application database. You can use Primavera Data Service endpoints to discover which database tables, views, synonyms and columns are accessible. You can also use a Primavera Data Service endpoint to fetch table, view, and synonym data.

This image illustrates the data flow described in the paragraph above.

Accessing Primavera Data Service

To use Primavera Data Service, you must authenticate with a user which has been assigned the appropriate Primavera Data Service role for the environment, for example Primavera Data Service Production or Primavera Data Service Stage. Roles are assigned in Primavera Administration. To check Primavera Data Service version, access https://<url>/pds.

Primavera Data Service uses a different base URL from other API services. To access Primavera Data Service send requests to the following base URL:

https://<url>/pds/rest-service/dataservice/<endpoint>?configCode=<configuration name>

The variables in the previous example URL should be replaced with the following information when accessing the data service:

  • <url>: The URL provided to you when the application was deployed.
  • <endpoint>: A valid data service endpoint, excluding the data service base URL. For example, runquery.
  • <configuration name>: The name of the configuration you want to access.

Note: The following configuration names are available to all customers with the associated applications.

Use ds_p6adminuser to access the P6 EPPM database as admuser.

Use ds_p6reportuser to access the P6 EPPM database as pxrptuser.

Use ds_unifier to access the Primavera Unifier database.

Example curl Request

The following example demonstrates accessing Primavera Data Service tables endpoint using curl:

curl -X GET -H "Accept:application/json" -u "<username>:<password>" https://<url>/pds/rest-service/dataservice/metadata/tables?configCode=<configuration name>

The variables in the previous example should be replaced with the following information when accessing the data service:

  • <url>: The URL provided to you when the application was deployed.
  • <username>: The username of an application user which will access Primavera Data Service.
  • <password>: The password associated with the user account used to access Primavera Data Service.
  • <configuration name>: The name of the configuration you want to access.

Incremental Changes

If the metadata of the application database changes (for example, data, tables, or columns, are added, removed, or renamed), use the appropriate Metadata Refresh Status Endpoint to synchronize Primavera Data Service with those changes.

Supported Date Formats

The following date formats are supported for requests:

  • yyyy-MM-dd hh:mm:ss TZH:TZM
  • yyyy-MM-dd hh:mm:ss TZHTZM
  • yyyy-MM-dd hh:mm:ss
  • dd-MMM-yyyy
  • dd-MMM-yyyy hh:mm:ss
  • yyyyMMddhhmmss.SSSZ
  • yyyyMMddhhmmss

The following date formats are supported for response:

  • yyyy-MM-dd hh:mm:ss TZH:TZM
  • yyyyMMddhhmmss.SSSZ

Limitations

  • Complex SQL queries cannot be replicated in JSON input. The API supports only:
    • Basic select statements with Where conditions for operators EQUALS, NOT_EQUALS, GREATER_THAN, LESS_THAN, GREATER_THAN_OR_EQUALS, LESS_THAN_OR_EQUALS, IS_NULL, IS_NOT_NULL, BETWEEN, IN, LIKE.
    • Basic joins between tables where the Primary Key and Foreign Key relationship is defined.
    • Basic explicit joins where there is no defined Primary Key and Foreign Key relationship defined.
  • To run the complex queries (subqueries, multiple joins, aggregate methods), it is recommended that you:
    1. Pull the required tables data using the basic select run query endpoint.
    2. Load the data into a local database.
    3. Run complex queries against the local database.
  • Related to data sorting
    • When a query is based on database objects "views" or "synonyms", PDS will sort on the first column name provided in the request payload as an input JSON columns property. However, you may observe duplicate records on the subsequent page request if the first column is non-unique. To avoid duplicate records, you can provide a list of columns as a unique key with the "orderByColumns" property in the input JSON.
    • When a query is based on database object "table", sorting will be performed on "ROWID" when "orderByColumns" property is not provided in the input JSON. Sorting is based on preferred columns using "orderByColumns" property. If there is no primary key available in "orderByColumns" list Primavera Data Service will append "ROWID" after your preferred columns for sorting.