Primavera Data Service Introduction

The Primavera Data Service exposes a set of endpoints that enable you to extract data from the application database. You can use the data service endpoint to discover which database tables and columns are accessible and run queries against them. Create JSON objects to specify database queries and submit them using the service's runquery endpoint. Upon processing a POST request and resolving a query, the runquery endpoint returns a JSON object containing application data that satisfies the query specified in the request body. You can use the JSON data returned by the service to analyze your application data.

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

Prerequisities

  1. Endpoint URL
  2. Configuration name for the schema user
  3. Username
  4. Password
  5. The RESTClient extension in Firefox or Postman in Chrome

General Process

  1. Open any browser.
  2. Enter the endpoint URL.
  3. When prompted, enter your cloud server username and password.

Accessing the Data Service

To use the Primavera Data Service, you must authenticate with a user which has been assigned the appropriate Primavera Data Services role for the environment, for example Primavera Data Services Production or Primavera Data Services Stage. Roles are assigned in Primavera Administration.

The data service uses a different base URL from other API services. To access the data service send requests to the following base URL:

https://<url>/sync/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 the data service tables endpoint using curl:

curl -X GET -H "Accept:application/json" -u "<username>:<password>" https://<url>/sync/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 the data service.
  • <password>: The password associated with the user account used to access the 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), the endpoints will synchronize with those changes the next time you run them.

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

The data service cannot be used to query BLOB or CLOB fields.

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

The API does not support queries using the LIKE, or IN conditions.

In order to run the complex queries (sub queries, 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.