Skip to main content
Solved

TimeXtender Rest Datasource with OAUTH2 Generated Bearer Token

  • 25 June 2024
  • 7 replies
  • 76 views

I am having issues getting the new ODX TimeXtender Rest API to connect using OAuth2 and an authentication service to generate an expiring bearer token.

I have been able to generate a token successfully using Postman, and I have been able to configure the standard ODX CData Rest datasource successfully with the authentication service. But using the same setup I am getting errors on the TimeXtender Rest service.

This is the OAuth2 settings from the standard Rest Data Source

CData Rest OAuth settings that work

This is the OAuth settings from the new TimeXtender Rest datasource that don’t work.

TimeXtender Rest API

The only thing potentially unusual was that when setting up my postman request to generate the Bearer Toekn the connection instructions specifically stated to setup the body as follows:

Postman 

However I did not have to set the encoding in the standard CData Rest.

I did try generating the bearer token in postman and then using that as a not expiring Bearer token to verify my core URL and Endpoint setup and that worked fine. just cant get the authentication service to work.

The error message I get is like the get request is not being passed the token.

My Error message received is as below:

Failed to execute endpoint 'datasets':
Failed to execute request for endpoint 'datasets'.
HTTP Status Code 401 Unauthorized
Response body:
{"message":"Unauthorized"}

System.Exception: Failed to execute request for endpoint 'datasets'.
HTTP Status Code 401 Unauthorized
Response body:
{"message":"Unauthorized"}
   at TimeXtender.ODX.RestEngine.RestEngine.ExecuteHttpRequest(ExecutionConfigurationContainer configContainer)
   at TimeXtender.ODX.RestEngine.RestEngine.ExecutePaginationLoop(ExecutionConfigurationContainer configContainer, CallbackObject callbackObject, Dictionary`2 dynamicValues)
   at TimeXtender.ODX.RestEngine.RestEngine.ExecuteDynamicValuesLoop(ExecutionConfigurationContainer configContainer, CallbackObject callbackObject)
   at TimeXtender.ODX.RestEngine.RestEngine.<>c__DisplayClass25_0.<CreateExecutionTask>b__0()

7 replies

Userlevel 6
Badge +5

Hi @Paul McLeod Bespoke Analytics 

I was trying an REST API yesterday that also required some parameters. I got a working setup and was doing the same setup on my end.

I decided to order the parameters in a way I found to be more “correct” compared to what the customer did. This did not work, for some reason. I attempted the same setup that did not work in Postman and it worked fine. So I changed the order of parameters in my setup and it worked.

So long story short, try to reorder the parameters and run it again. See if the ordering makes any difference.

Userlevel 6
Badge +5

Hi @Paul McLeod Bespoke Analytics 

Have you gotten a chance to test reordering the parameters as suggested by Thomas above?

Could you please share a screenshot with the full data source settings?

You might have to add headers that are automatically added in Postman to the advanced header properties in the portal. For example for the below REST API, I had to add Accept */*. I tested this by unchecking the headers in Postman to see which ones were required for the GET call

 

Userlevel 1
Badge

Thanks Tom and Christian, I will test today and let you know if that made any difference.

Userlevel 1
Badge

Additionally I have been able to setup the CData with no issues. Just selected “GETANDREFRESH” and put in the token service URL and the ClientID and ClientPassword and worked like a charm.

 

Below is the entire definition of the TX Rest API.

 

Userlevel 6
Badge +5

Hi @Paul McLeod Bespoke Analytics can you please try sharing the screenshot for “entire definition of the TX REST API” again? 

Userlevel 1
Badge

Hey Christian, I am having issues adding the images. I keep getting messages that the content will be reviewed by the moderators and noting posts.

 

Also wondering if it would be possible to arrange a session with someone to review what I am doing to maybe short cut the process. kind of want to get this resolved for the client. have a nasty nested query I would rather not hand craft an RSD file for.

Userlevel 6
Badge +5

Hi @Paul McLeod Bespoke Analytics 

We can do a meeting. Send a request to support@timextender.com so we can find a time that fits our schedules.

Reply