Cognos Analytics

 View Only
  • 1.  Cognos on Cloud trial - REST API authentication with API KEY

    Posted Sun September 08, 2024 12:23 PM
    Edited by Andrei Istomine Sun September 08, 2024 12:31 PM

    Greetings!

    I have to build a quick POC with Cognos on the Cloud for the Cognos REST API integration.

    I am authenticating REST session with the CAMAPILoginKey.

    Authentication seems fine but the Server response does not return the Session Key.

    Is it intentional on the Cloud Free Trial? Or is it some known issue in the C12 REST API configuration?

    @GREG MCDONALD @Shawn Crook



    ------------------------------
    Andrei Istomine
    Open to work - anything Cognos
    https://www.linkedin.com/in/andreii/
    ------------------------------



  • 2.  RE: Cognos on Cloud trial - REST API authentication with API KEY

    Posted Tue September 10, 2024 02:46 PM

    I'm using 11.2.4 FP4, and to make it work, I have to first do a GET (with no data) to get the XSRF-TOKEN, then the put with the API key, and I see the session key in the results:

    C:\Python> python RestAPI-script.py
    Get session
      warnings.warn(
    {"errorCodeString":"camAuthUserRecoverable","messages":[],"promptInfo":{"displayObjects":[{"name":"CAMNamespaceDisplayName","caption":"Namespace:","type":"display","value":"CJAP"},{"name":"CAMUsername","caption":"User ID:","type":"text"},{"name":"CAMPassword","caption":"Password:","type":"textnoecho"},{"name":"h_CAM_action","type":"hidden","value":"logonAs"},{"name":"CAMNamespace","type":"hidden","value":"CJAP"}],"captions":["Please type your credentials for authentication."]}}
    401
    <RequestsCookieJar[<Cookie XSRF-TOKEN=bAlVwdmHKtEOrVIyGsgpoTM9m6Sg8mmb for concurssl81.fyre.ibm.com/api>]>


    Starting APIKey Session
      warnings.warn(
    {"generation":3,"shareable":false,"isAnonymous":false,"cafContextId":"CAFW000000a0Q0FGQTYwMDAwMDAwMDlBaFFBQUFEU3JVN2QwREYwNlM5bEZoaS1vY1pRLUdQY0d3Y0FBQUJUU0VFdE1qVTJJQUFBQUE3bzk4Wkwxd1N6ZVRldWp1NTYyYzJnQTlNbHlkSDQxcTloMUJJKnZLUEw0Nzk0NDJ8cnM_","logEnabled":false,"canCallLogon":false,"url":"/api/v1","session_key":"CAM MTsxMDE6ZTRiMThlYzktM2ZkMy00YmVkLWJiNmQtNGJhOTcxOGU0NzU5OjMwOTk4MDU1MTg7MDszOzA7"}
    201



    ------------------------------
    ROBERT WRIGLEY
    ------------------------------



  • 3.  RE: Cognos on Cloud trial - REST API authentication with API KEY

    Posted Tue September 10, 2024 03:19 PM
    Edited by Andrei Istomine Tue September 10, 2024 03:20 PM
    Thank you Robert.
    I'm testing it using Swagger in CoC ( build 12.0.3-2407130034 )

    https://us3.ca.analytics.ibm.com/api/api-docs/#/session/create_update_session

    Request body: 

    {"parameters": [ { "name": "CAMAPILoginKey", "value": "AWlDQjY0RUY1OUY4RjY0NkU2QjM0NEJENzU2QkJFQzA4QuKvfUuGKHKI0ITaTh4z2LRdRmF+" } ] }

    It does use the X-XSRF-Token header in the PUT call.

    Rumor has it that the absence of the SESSION_KEY might be due to some misconfiguration of that specific environment...
    Just wanted confirmation from IBM.

    --

    Thanks,
    Andrei Istomine




  • 4.  RE: Cognos on Cloud trial - REST API authentication with API KEY

    IBM Champion
    Posted 16 days ago

    I was having a similar issue with my sandbox environment and reached out to Support. They were able to narrow down the problem to a misconfiguration in the advanced settings. While this may not solve all cases where the session_key doesn't appear, it fixed mine.

    • Login to Cognos Analytics
    • Go to Manage>Configuration>System>Advanced settings
    • In the Key field, type the following: Configuration.cookieSameSite
    • Then click in the value field and then type 'myDefault' without quotes

    I'm not sure if this can help with the free trial environment, if you don't have admin capabilities you won't be able to do it.



    ------------------------------
    Paul Mendelson Product Manager
    Product Manager
    PMsquare
    ------------------------------



  • 5.  RE: Cognos on Cloud trial - REST API authentication with API KEY

    Posted 15 days ago

    Thank you Paul.

    On my latest on-Prem Cognos sandbox (12.0.3-2404172034) REST API authentication  does return the session_key.

    And apparently, that Advanced setting Configuration.cookieSameSite=myDefault was there right after the installation.

    Though, even I modify the Value  or even delete that Key authentication still comes back with the session_key.

    On my Cloud trial I do not have access to the Advanced settings. So can't confirm it that Key can fix anything



    ------------------------------
    Andrei Istomine
    Open to work - anything Cognos
    https://www.linkedin.com/in/andreii/
    ------------------------------