IBM Support

How to Connect to Planning Analytics as a Service Database using REST API with PA API Key

How To


Summary

This document outlines the steps to connect to a Planning Analytics as a Service Database, using the REST API with PA API Key

Environment

Document is applicable only to Planning Analytics as a Service, where the API Key is generated in Planning Analytics.

Steps

See: https://cloud.ibm.com/docs/planning-analytics?topic=planning-analytics-api__key_based_authentication

OBTAIN AN API KEY FROM PLANNING ANALYTICS 
  • In your web browser, navigate your Planning Analytics as a Service URL and log in
  • In the top right, select your name and click Manage API Keys
  • Click the Generate Key button.  Provide the Name and Description and click Generate key. 
  • Copy the key to the clipboard or download and save as needed.
    • NOTE: The key can not be retrieved once this window is closed
  • You have now successfully created an API Key which can be used to Planning Analytics as a Service

AUTHENTICATING TO PLANNING ANALYTICS AS A SERVICE USING API KEY
The steps below are demonstrated using Postman for the REST API client, however, are applicable to all REST API clients.  To download and install Postman, see: https://www.postman.com/downloads 
 
  • Open Postman and create a New Collection.  In this example, we have created a collection named PA as a Service 
  • To communicate with Planning Analytics as a Service, a paSession cookie must be passed with any requests.  This paSession must be retrieved and saved for reuse by subsequent requests.  PostMan will handle this automatically.
    • Add the following variables (apikey, tm1db, tenant, host), and populate the Initial value with the settings that reflect the environment you are connecting to:
    • Be sure to update with your own apikey. Tenant and Host information can be found in your PA URL: https://us-east-1.planninganalytics.saas.ibm.com/?accountId=A1BCDEFGHO1X&tenantId=8ABCDE2FGH1E&perspective=pa-administration 
  • Add a new HTTP Request to the PA as a Service collection.  Change the type of Request to a GET request, and paste the following as the URL: {{host}}/api/{{tenant}}/v0/rolemgmt/v1/users/me 
  • Click the Authorization tab of the GET request and select Basic Auth
    • Input the username as the string: apikey
    • Input the password as the string: {{apikey}}    (this contains the API Key variable value)
  • Save the new HTTP Request with an appropriate name such as ‘Authenticate to Planning Analytics’.  
  • Click the Send button to send/test the HTTP Request
    • If set up correctly, the Response Body will return your user details
    • A paSession cookie will be set for use with subsequent requests
  • You have now successfully created an HTTP Request to establish a session with Planning Analytics

USING PASESSION TO COMMUNICATE WITH PA SERVER VIA REST API
To communicate with the PA Server via the REST API, a valid paSession cookie is required.  The cookie must be included with any request to the PA Server.
 
  • Add a new HTTP Request to the PA as a Service collection.  The type of request should be a GET request, using the following URL: {{host}}/api/{{tenant}}/v0/tm1/{{tm1db}}/api/v1/Cubes 
  • Click the Auth tab of the new request.  Ensure auth type is set to No Auth.
  • Save the request with an appropriate name, such as ‘Get Cubes from TM1 Server’
  • Click Send to execute and test the REST API request.  If successful, the output of the /api/v1/Cubes TM1 Server request is provided in the response.
    • If unsuccessful (403 Forbidden), review the Headers tab of the request and look at the Cookie value for a paSession cookie. 
    • If not set, revisit the previous section and review the apikey authentication.

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSD29G","label":"IBM Planning Analytics"},"ARM Category":[{"code":"a8m3p000000LQtUAAW","label":"Planning Analytics"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
18 June 2024

UID

ibm17137883