Authentication and Authorization

Authentication

The Primavera Administration API supports HTTP basic authentication and SSL authentication.

Authentication using cURL

To authenticate using cURL, pass the username and password for your Primavera Administration account using the -u cURL option:

		curl -u <username>:<password> -H "Accept:application/json" -H "Version:<releaseVersion>" -X GET https://<hostName>:<portNumber>/cloudapi/restapi/<service>
		

For example:

		curl -u jsmith:mypassword1 -H "Accept:application/json" -H "Version:2" -X GET https://localhost/cloudapi/restapi/user
		

To authenticate using Node.js, pass the username and password for your Primavera Administration account using the auth property of an HTTP request object:

//...Code omitted for emphasis 
      var options = { 
          hostname: "<hostName>", 
          port: <portNumber>, 
          method: 'GET', 
          path: "
		/cloudapi/restapi/<service>", 
          auth: "<username>:<password>" 
      } 
      //...Code omitted for emphasis
		

For example:

//...Code omitted for emphasis 
      var options = { 
          hostname: "localhost", 
          port: 7001, 
          method: 'GET', 
          path: "
		/cloudapi/restapi/user", 
          auth: "jsmith:mypassword1" 
      } 
      //...Code omitted for emphasis
		

Authorization

Primavera Administration provides security at the application level. The user account you specify when sending requests to the API must be authorized to access the application and the objects requested through the API endpoints. For example, to request user information from the /user/{userid} endpoint, you must connect to the API using an account that is authorized to access the user with the specified ID value. If the account does not have authorization to access the contents of an API endpoint, the API will return a 401 or 404 response.

Refer to the Application Administration Guide for information on configuring user access to the application.