Skip to main content

Dear Sir,

I am trying to set up a CData Json datasource connection with TimeXtender.

This is my connectionstring:
Auth Scheme=OAuth;Data Model=Document;Initiate OAuth=REFRESH;OAuth Access Token URL=https://pilot.binnenbeter.nl/api/v2/login/venray;OAuth Grant Type=PASSWORD;OAuth Refresh Token URL=https://pilot.binnenbeter.nl/api/v2/login/venray;Row Scan Depth=100;User=api@venray.nl

I am able to get the bearer Token with Postman with this:

url: https://pilot.binnenbeter.nl/api/v2/login/venray

JSON Body:

{

  "id""",

  "language""en",

  "data": {

    "resourceType""AUTH",

    "item": {

          "loginName"api@venray.nl

          "password""password",

          "module""API"

    }

  }



This is the documentation I used for the connectionstring:

Password

Finally there also is an Password method. It is similar to the others, in that it requires an Access Token URL and an Refresh Token URL, the difference is that it uses an User and Password instead of client and secret. Notice that these fields are in the "Authentication" section, not in the area of the other OAuth fields.

mceclip0.png

But it doesn’t work:
Service request failed: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> djo230f.nQ: URI or DataSource must be set if schemas are not available in C:\Users\RijnA\AppData\Roaming\CData\JSON...

Module: TimeXtender.ODX.Engine

TimeXtender.ODX.Engine.ODXFaultException

   at TimeXtender.ODX.Engine.ODXEngine.SendServiceRequest/C](WcfServerSettings serverSettings, ProjectInformation projectInformation, Action`2 action)

   at TimeXtender.ODX.Engine.DataSourceController`1.TestConnection(DataSourceModel dataSourceModel)

   at TimeXtender.DataManager.ConnectingThread.ExecuteConnectingThread(Object dummy)

 

Please advice, this is a tough cookie.

 

Regards,

Arthur

Hi,

have you set up the datasource URI under the connection settings? You need to specifiy everything in one go in CData, you are not defining separate calls.


Hi Rory,

I updated the connectionstring with the datasource URI:

Auth Scheme=OAuth;Data Model=Document;Initiate OAuth=REFRESH;OAuth Access Token URL=https://pilot.binnenbeter.nl/api/v2/login/venray;OAuth Grant Type=PASSWORD;OAuth Refresh Token URL=https://pilot.binnenbeter.nl/api/v2/login/venray;Row Scan Depth=100;URI=https://pilot.binnenbeter.nl/api/v2/organization/reports/find/venray?;User=api@venray.nl

Can not find any valid JSON resource for supplied URI


Is it possible to create a support ticket for this ?

Thanks in advance.

Regards,

Arthur


Hi @avanrijn 

Do you have a link to the API documentation?


Hi Christian,

Yes sir, this is the link to the API documentation:

Connect to a REST API using the CData provider | Community (timextender.com)
(scroll to bottom of the webpage Ctrl F: Password)


Regards,

Arthur


I think Christian means this: https://pilot.binnenbeter.nl/api/index.html


Hi yes, @avanrijn could you please provide API documentation for https://pilot.binnenbeter.nl/api/index.html?


Hi Christian,

Sorry I misunderstood.

Here is  the link to the binnenbeter documentation: https://app.loopedin.io/binnenbeter/kb/open-api

Open API | BinnenBeter (loopedin.io)

Regards,

Arthur


@avanrijn Thanks, I have created a support ticket for this now


Dear Sir,

Please find in the attachment the configuration for our Json connectivity, including the Log files.

I setup a Json and a REST CDATA datasource in TX.

Maybe, it would be nice to set up a call for this.

Now I have a Unsupported Media Type error.

Thanks in advance.

 

Regards,

Arthur


@avanrijn have you tried the get call in Postman? If so can you please confirm what the content type is set to?

 


Hi Christian,

I have used Postman to connect. The connection is succesful.
Please have a look at the attached Word file for details (Doc1.docx).

TimeXtender on the other hand is giving me an error: 415 Unsupported Media Type

Please assist, I don't know to handle the Json Web Token (JWT) I recieve from Postman in TimeXtender JSON CDATA.

Hope you can shine a light on this.

Regards,

Arthur

Attachment: Doc1.docx


@avanrijn thanks for the info. I have passed this onto Cdata and will let you know as soon as I have a response.


Hi @avanrijn 

Please see below response from Cdata:

“After reviewing the request body required to obtain an Access Token from the API, it seems that this uses a custom OAuth authentication method that cannot be handled by the connection manager. To address this, I have created an RSB schema file to manage the OAuth flow. Please find attached the GetOAuthAccessToken.rsb schema file. You will need to place it in the directory specified by the Location property (default: %APPDATA%\\CData\\REST Data Provider\\Schema): https://cdn.cdata.com/help/DWK/ado/RSBREST_p_Location.htm

NOTE: Please ensure that the RSB is placed in the correct location, as the OAuth flow logic is implemented within the RSB schema file. The driver must access this RSB to connect with the API. As mentioned, customization of the RSB is necessary because the OAuth flow for this API is non-standard. More details on Customizing Schemas: https://cdn.cdata.com/help/DWK/ado/pg_CustomSchemas.htm

The connection properties you need to configure in this case are:
AuthScheme=OAuth; Data Model=Document;Initiate OAuth=GETANDREFRESH; URI=https://pilot.binnenbeter.nl/api/v2/organization/reports/find/venray; OAuthClientId= api_prod@venray.nl; OAuthClientSecret=YourPassword;

In the RSB schema file, I have mapped the OAuthClientId to your "loginName": and OAuthClientSecret to your "password", allowing you to set them from the connection manager.

The only changes you may need to make in the RSB schema file are for the "id": "" field, as I’m unsure if you specify an ID in Postman to obtain the token. Additionally, I have set the ExpiresIn value to 900 seconds, meaning the token is valid for only 900 seconds, after which the driver will request a new token. If you know the actual duration of the token's validity, you can adjust this value accordingly. 
I ran the tests on my end using the REST driver, but I believe the JSON driver should work as well.”


Hi Christian,

I opened ticket #31920 again for this topic. The CData solution is not working on my side.

I hope Thomas can have a look at this. 

Thanx.

 

Regards,

Arthur

Request #31920


During the call we determined that the issue seems to be related to internal problems at the API vendor since some calls were successful, and other calls with the same settings failed from another machine


Reply