Hi
I find the IBM documentation on this rather confusing where it talks about returning the details of the CAM server. That isn't necessary. In reality if someone is logging on then they are going to know whether they want to use TM1 or CAM authentication, or the application developer will have set this for them. You only need to talk to the TM1 Rest API end point, not the CAM URI. The TM1 Server knows how to go to CAM via the information in its TM1S.CFG. It will do that for you.
Below is a fragment of VueJS code that handles the formatting needed for TM1 or CAM Authentication. As per the comments, my VueJS code calls a NodeJS server which then adds on additional headers and makes the final call to the Rest API. However, the core bit is covered below in terms of making up the login details that need to be attached to the Authorization header.
async Submit() {
try{
// AuthType is TM1 or CAM
const AuthType :string = this.AuthType
const User :string = this.UserName
const Pwd :string = this.Pwd
// this.CAM will give the name of the CAM Name Space if using CAM
const CAM :string = this.CAM
let LoginType :string = 'Basic'
let UserDetails :string = User + ':' + Pwd
if(AuthType == 'CAM')
{
LoginType = 'CAMNamespace'
UserDetails += ':' + CAM
}
// This bit does the Base64 Encoding in JS
const LoginDetails :string = LoginType + ' ' +
Buffer.from(UserDetails,'binary').toString('base64')
const body = {
LoginDetails: LoginDetails
}
// HTTP is an object set up with the end point for a NodeJS
// server which adds additional headers to make the final call
// to the TM1 Rest API
const response = await HTTP.post('./Connect',body)
Now, if IBM could add some further information on handling certificates for SSL that would be good...
Regards
Paul Simon
------------------------------
Paul Simon
------------------------------
Original Message:
Sent: Wed July 07, 2021 10:30 AM
From: STUART KING
Subject: End points Planning Analytics 2.0.9 TM1 REST API
Please see: https://www.ibm.com/docs/en/planning-analytics/2.0.0?topic=api-authenticating-managing-sessions#concept_ed4_h2h_ghb
This explains how authentication with the REST API works.
------------------------------
Stuart King
IBM Planning Analytics Offering Manager
------------------------------