Use OAuth Token for HTTP Authentication

The Oracle Primavera Cloud API uses HTTP token authentication to authenticate requests. To authenticate, clients must provide the token generated by a valid Primavera Cloud user or an authorization server in the HTTP headers of their requests. Various tools and programming languages, such as curl and Java, offer mechanisms to facilitate HTTP token authentication.

Depending on the authentication type you are using, see the How Does Primavera Cloud Support Basic Authentication? or How Does Primavera Cloud Support OAuth 2.0? sections to generate an OAuth token to access the API.

Authentication Using Curl

To authenticate using curl, include the OAuth token generated through Basic Authentication or an authorization server in your request headers.

curl -X GET http://<SERVER_URL>/api/restapi/util/testConnection -H "Authorization: Bearer <OAuth-Access-Token>" -H "Content-Type: application/json" -H "Version: <versionNumber>" -H "x-prime-tenant-code: <tenant-code>"

Replace the variables in the example with the following information:

Element Description
<SERVER_URL>/ The server URL where the application is deployed (For example, primavera.oraclecloud.com).
<OAuth-Access-Token> The OAuth token generated using Basic Authentication or an authorization server.
<versionNumber> The API version. Providing this is optional; the default is the latest version which is 3.
<tenant-code> The Primavera Cloud tenant where the data exists.

Sample Curl Request Using OAuth Token

Construct the curl request with the OAuth token and additional headers as follows :

curl -X GET http://<SERVER_URL>/api/restapi/util/testConnection -H "Authorization: Bearer <OAuth-Access-Token>" -H "Content-Type: application/json" -H "Version: <versionNumber>" -H "x-prime-tenant-code: <tenant-code>"

Authentication Using a REST Client

Construct the request in the REST client with the OAuth token as follows:

GET: https://<SERVER_URL>/api/restapi/workspace/1
Authorization: Bearer <OAuth-Access-Token>
- H "x-prime-tenant-code: <tenant-code>"

Authentication Using Java

To learn how to authenticate using the HTTP token authentication with Java, see the Sample Java Code topic.

Note: Federated users can invoke Public API using OAuth 2.0. Refer the methods mentioned in How Does Primavera Cloud Support OAuth 2.0? for more information.