Skip to main content

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()

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.


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

 


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


So no joy re-organizing the parameters on the OAuth call. Likewise on including additional header parameters.

One thing i have noticed in the format of the response from Postman does include a refresh token. Not sure if that means that I have to use the OAuth2 and refresh token option? Not sure what is required for that. Below is the response from the Postman call (tokens have expired).

{

    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICIxZkN3NlhRcFNxQjI1UDh6ejdyUWhmQnJETkFPNEdsOWppTUNZa0Z3UWZNIn0.eyJleHAiOjE3MTk4NjI5NTIsImlhdCI6MTcxOTg2MjY1MiwianRpIjoiMTBkOTVlYmItZTc5OC00NGQ0LWJhY2UtM2UzNWQyNjhiMGIxIiwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy5wcm9kLnF1YW50ZW1wbGF0ZS5jb20vYXV0aC9yZWFsbXMvcXQiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiOTQ1ZjgxNzUtMDNhOS00NDZjLWI1NWUtYzUwYWNkNDhjY2RlIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoidS1hcGktdW5yIiwic2Vzc2lvbl9zdGF0ZSI6ImI1Y2Y3ODYwLTBhNGMtNDUxZC1iMWM3LTU2NzAyM2M4YmJmYyIsImFjciI6IjEiLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsib2ZmbGluZV9hY2Nlc3MiLCJ1bWFfYXV0aG9yaXphdGlvbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoiZW1haWwgcHJvZmlsZSIsImNsaWVudElkIjoidS1hcGktdW5yIiwiZW1haWxfdmVyaWZpZW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ijk0NWY4MTc1LTAzYTktNDQ2Yy1iNTVlLWM1MGFjZDQ4Y2NkZSIsInR5cCI6IlJlZnJlc2giLCJhenAiOiJ1LWFwaS11bnIiLCJzZXNzaW9uX3N0YXRlIjoiYjVjZjc4NjAtMGE0Yy00NTFkLWIxYzctNTY3MDIzYzhiYmZjIiwic2NvcGUiOiJlbWFpbCBwcm9maWxlIn0.fapsk2tS3GhjzZAR4Qn6yVKwKg-qcSuH6LEAy7kV8Xw",

    "token_type": "bearer",

    "not-before-policy": 0,

    "session_state": "b5cf7860-0a4c-451d-b1c7-567023c8bbfc",

    "scope": "email profile"

}


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.

 


 


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


 


 


 


API COnfig

 


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.


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