Skip to Content
Technical Articles
Author's profile photo Karthik Ramachandran

How to consume SAP Project Intelligence Network APIs

Introduction

SAP Project Intelligence Network is a cloud-based solution for collaboration between all partners in construction and engineering projects. The application uses a digital twin as the central point for integrating and fostering collaboration between all involved parties. From conceptualization to delivery, all partners in a project can work closely to design and build facilities and assets.
With SAP Project Intelligence Network, you can share crucial information and important documentation about the project with project partners.

SAP Project Intelligence Network also provides APIs which can be used to integrate with other applications or to extend the core capabilities offered.

Sometimes, people face difficulties in getting started with consuming such APIs by just relying on the SAP help documentation. In this blog, this is explained in a simple step-by-step manner.

Prerequisites

  • You have onboarded to SAP Project Intelligence Network. Refer to the onboarding guide for more details.
    • Verification criteria
      • Your subaccount should have an entitlement for SAP Project Intelligence Network
      • You should have subscribed to SAP Project Intelligence Network (PIN) in your subaccount with the Application plan – “standard”
  • You have the necessary authorizations to manage the subaccount

Steps

Summary

  1. Enable Cloud Foundry in the subaccount
  2. Create a service instance of SAP PIN API service
  3. Create a service key
  4. Assign roles
  5. Perform API invocation

Enable Cloud Foundry in the subaccount

This is needed to consume services in cloud foundry. “SAP Project Intelligence Network” API service is one of such services.

  1. Log on to SAP Business Technology Platform cockpit
  2. Navigate to the subaccount by following the steps
  3. Select the created subaccount in the cockpit
  4. Choose “Enable Cloud Foundry”
  5. Provide a Cloud Foundry organization name, and then click on “Create”

Create PIN API service instance

The service instance that gets created shall act as an OAuth Client

  1. Navigate to the subaccount in BTP Cockpit where PIN is subscribed to
  2. Go to Services and Marketplace
  3. Choose “Service” from the filter for “types”
  4. Search for “SAP Project Intelligence Network”
  5. Click on the tile shown above
  6. Choose the “default” plan under the “Service Plans” section
  7. Click on “Create” button as highlighted in the screenshot
  8. In the dialog that opens, click on the “Create a space” link if you do not have an existing space
  9. Provide an appropriate name for the space name and click on “Create”
  10. Enter a suitable instance name
  11. Click on “Next”
    1. Optional step:
      1. Background – When using the OAuth 2.0 authorization code grant, you can specify the allowed redirect-URIs to the application that calls PIN APIs or the integration system that handles the callback call.

      2. The redirect URIs information has to be entered in a JSON object in the dialog

        {
          "xs-security": {
            "xsappname": "<unique-appname>",
            "oauth2-configuration": {
              "redirect-uris": [
                "https://<your-domain>/**"
              ]
            }
          }
        }
        
        
  12. Click on “Create”
  13. You’ll see a success message like below

Create a service key

The service key provides the credentials to talk to the UAA associated with the subaccount and the PIN API endpoint URL

  1. Go to the service instance created in the previous step
  2. OR
  3. Click on “View Instance” in the previous dialog
  4. Click on the “Create” button in the “Service Keys” section as shown above
  5. Enter a name for the service key and click on “Create” in the dialog
  6. Now, click on “View” service key by clicking on the “…” button as shown
  7. Note down the values of the below parameter from the json shown
    1. clientid
    2. clientsecret
    3. apiurl
    4. url  – under “uaa” in the json

Assign Roles

To execute certain operations in PIN, the necessary roles have to be assigned. Refer here.

Perform API invocation

PIN enables API access via OAuth 2.0 Authorization Code flow

  1. Go to Postman app
  2. Create a new request
  3. Get access token
    1. In the “Authorization” section choose the type as oAuth 2.0
    2. Provide the previously noted credentials in the Authorization screen
      • You can either enter the details directly or use Postman environment variables like shown below
    3. Click on “Get New Access Token”
    4. Click on “Use Token” in the dialog
  4. Let’s invoke the PIN Projects API to test if the credentials work
    1. Enter the following text in the URL field: “{{API_URL}}/ProjectService/v1/Projects
    2. Replace {{API_URL}} with the “apiUrl” noted earlier
    3. Click on “Send”
    4. In the response, you shall get the list of projects you are authorized to view (in case projects exist)
  5. You can explore other APIs by referring to the APIs in SAP API Hub

Summary

I hope that after going through this blog, you were able to perform the necessary configurations as described and invoke PIN APIs.

In case of any queries, feedback w.r.t API consumption, you can post a comment. If there are general queries on SAP Project Intelligence Network please post a Question and assign the tag “SAP Project Intelligence Network”

Assigned tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo André Ferreira
      André Ferreira

      Hi Karthik,

      I was already get access token as you described but since last week it's not working.

       

      "Invalid redirect https://localhost did not match one of the registered values"

       

      Are you still able to get token?

      Best regards,

      André

      Author's profile photo Deepu Sajan
      Deepu Sajan

      Hello Andre,

       

      Probably Secure-Http , http(s) , is the issue. Can you try with http://localhost ?

       

      Regards,

      Deepu Sajan

      Author's profile photo André Ferreira
      André Ferreira

      Hi Deepu,

       

      Problem remains, error message is the same.

      "Invalid redirect http://localhost did not match one of the registered values",

       

      Regards,

      André