You can translate the question and the replies:

When creating JSON source, how to save Session ID from an authentication and then use another URL for data ?

Hi, I am trying to create a JSON source in Denodo (and I've done it before). This particular external source has the following condition - "In order to access documents via the API, you must be logged in as an authenticated user. This is handled through the login call. The login call will return a session id which must be included in the cookies header on all subsequent calls.". So, the JSON connection has to be to different endpoint, for example: http://xyz.com/login And the JSON datasource will be http://xyz.com/data. I wasn't sure how to achieve this in Denodo. So, Could you please assist us with this scenario. Thank you.
user
14-11-2014 11:39:52 -0500

3 Answers

Hi, maybe you can try this: the idea would be to have two data sources/base views, one for the 'login' and other one for the 'data' request: - The first view will return the session_id as an output field. - The second data source should be configured to have an HTTP header like 'Cookie=@sessionid'. This way the base view will have a mandatory input parameter (sessionid). Finally, you will need a third view (a NESTED join view, using 'sessionid = session_id' as join condition) so when a user executes this view, it will fetch the session_id from the left side of the join and then, once done, it will get the data from the second view. And, if you know the valid time to live for the session_id, maybe you can cache its value to reuse it between executions.
Denodo Team
17-11-2014 10:34:02 -0500
Hello, The answer is definitely a clever us of taking the response from one HTTP call and using it in another one. However, what about if the second HTTP call requires not a simple header, but it requires that a Cookie be set. Can we set cookies from within Denodo such that that cookie is then passed to the second HTTP call? Is there a way to mimic the setting of cookies by setting an HTTP header? Thanks~!
user
25-11-2014 17:17:54 -0500
Hi, you can use a browser to check the HTTP headers sent. For example, I just used my Chrome browser to search something in Google and I can see a "cookie" header was sent with lot of information. If your parameter is sent this way, then you can configure the data source in Denodo appropriately.
Denodo Team
26-11-2014 09:07:31 -0500
You must sign in to add an answer. If you do not have an account, you can register here