Jump to content

How to call an API in spotfire with 2I authetication?


Rupinder Kaur 2

Recommended Posts

Hi Fredrik,

Thanks for reaching out. I need to display the data on the Spotfire dashboard from the API. It's the JWT-protected API, so I am required to pass the token and authorization in the header. I would like to know how it can be done, if there is a script or a data function that can help me do the same. So, the moment the dashboard gets opened, the API should run automatically and display the data on the page.

Thanks!

Link to comment
Share on other sites

Rupinder,

The IronPython Scripting in Spotfire page has a few examples like this one IronPython Script to call a REST web service with Authentication. If needed, you could convert this into a python data function. The data function should be able to run at analysis open. If you go with IronPython, you can use the Custom DataTime Data Function for Spotfire which can trigger an IronPython script at analysis open.

Hope these are helpful.

Regards,

Peter

Link to comment
Share on other sites

We need a script that can take care of the automatic generation of the token. Basically, perform the below tasks: 1) Get a request to get token authentication.

2) Post a request to get the output with the header client ID, SSO, and authorization key generated in step 1.

Response output will be JSON.

4) After that, we need a code that can convert JSON to a datatable or dataframe.

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...