<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Authentication when using the URL_Connector to query data from a REST API in Streaming Analytics</title>
    <link>https://communities.sas.com/t5/Streaming-Analytics/Authentication-when-using-the-URL-Connector-to-query-data-from-a/m-p/912980#M306</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running into a little bit of an issue with the URL connector and using it to query data from an API.&lt;/P&gt;&lt;P&gt;To try and do a proof of concept, I had made a python script to connect and verified that the API spit out the data I expected in the correct format. Just like I did when hand-testing in the browser, I used the URL like so: &lt;A href="https://id:pwd@somedomain.tld/api/folder/subfolder/object" target="_blank"&gt;https://id:pwd@somedomain.tld/api/folder/subfolder/object&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This however seems to be causing some issues in SAS as the colon is used to indicate a port number and the&amp;nbsp;@ is usually there to mark an environment variable. As a result, when trying to run my ESP project, I get the following error:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;failed to retrieve data from https://id:0/api/folder/subfolder/object/, error Name or service not known&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My next logical step for this was to try and remove the credentials from the URL to see if I could at least reach the API server. So I tried connecting to &lt;A href="https://somedomain.tld/api/folder/subfolder/object" target="_blank"&gt;https://somedomain.tld/api/folder/subfolder/object&lt;/A&gt;/ and that did get me another error. After 300s of idling, I got a 403 response, indicating that the authentication service of the API must have timed out waiting for the login information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone here have a tip on how I can manage to get this one API call to work within ESP?&lt;BR /&gt;Any tips and tricks are appreciated, I feel a little bit at the end of my wits here.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2024 14:16:18 GMT</pubDate>
    <dc:creator>VMoraal</dc:creator>
    <dc:date>2024-01-25T14:16:18Z</dc:date>
    <item>
      <title>Authentication when using the URL_Connector to query data from a REST API</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/Authentication-when-using-the-URL-Connector-to-query-data-from-a/m-p/912980#M306</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running into a little bit of an issue with the URL connector and using it to query data from an API.&lt;/P&gt;&lt;P&gt;To try and do a proof of concept, I had made a python script to connect and verified that the API spit out the data I expected in the correct format. Just like I did when hand-testing in the browser, I used the URL like so: &lt;A href="https://id:pwd@somedomain.tld/api/folder/subfolder/object" target="_blank"&gt;https://id:pwd@somedomain.tld/api/folder/subfolder/object&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This however seems to be causing some issues in SAS as the colon is used to indicate a port number and the&amp;nbsp;@ is usually there to mark an environment variable. As a result, when trying to run my ESP project, I get the following error:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;failed to retrieve data from https://id:0/api/folder/subfolder/object/, error Name or service not known&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My next logical step for this was to try and remove the credentials from the URL to see if I could at least reach the API server. So I tried connecting to &lt;A href="https://somedomain.tld/api/folder/subfolder/object" target="_blank"&gt;https://somedomain.tld/api/folder/subfolder/object&lt;/A&gt;/ and that did get me another error. After 300s of idling, I got a 403 response, indicating that the authentication service of the API must have timed out waiting for the login information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone here have a tip on how I can manage to get this one API call to work within ESP?&lt;BR /&gt;Any tips and tricks are appreciated, I feel a little bit at the end of my wits here.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 14:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/Authentication-when-using-the-URL-Connector-to-query-data-from-a/m-p/912980#M306</guid>
      <dc:creator>VMoraal</dc:creator>
      <dc:date>2024-01-25T14:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication when using the URL_Connector to query data from a REST API</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/Authentication-when-using-the-URL-Connector-to-query-data-from-a/m-p/913848#M307</link>
      <description>&lt;P&gt;I don't think the url connector is expecting user/password information in the url.&amp;nbsp; I will submit a request to update ESP to support that.&amp;nbsp; What release of ESP are you using?&amp;nbsp; That will help us find a work around.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 16:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/Authentication-when-using-the-URL-Connector-to-query-data-from-a/m-p/913848#M307</guid>
      <dc:creator>AndyT_SAS</dc:creator>
      <dc:date>2024-01-31T16:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication when using the URL_Connector to query data from a REST API</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/Authentication-when-using-the-URL-Connector-to-query-data-from-a/m-p/913956#M309</link>
      <description>&lt;P&gt;Hi AndyT,&lt;/P&gt;&lt;P&gt;Thanks for your answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I'm currently on SAS Viya 2023.08 (v7.40.19), but...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since posting my question, I have found that using a Basic HTTP authorization should theoretically work as I was able to successfully query the API with a curl command inside the pod where the ESP engine lives. While I couldn't find it in the documentation (I may not have been very thorough), The same Auth token can be used as an HTTP header. As a result, the previously mentioned login method is no longer necessary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe it would be an idea to include this sort of information in the documentation page for the URL connector?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My config file now looks like the one presented here:&lt;/P&gt;&lt;PRE&gt;&amp;lt;url-connector&amp;gt;
&amp;lt;url-publishers&amp;gt;
&amp;lt;url-publisher name='myconnector'&amp;gt;
&amp;lt;requests&amp;gt;
&amp;lt;request name="myconnector"&amp;gt;
&amp;lt;url&amp;gt;&amp;lt;![CDATA[https://api-url.tld/api/resource/]]&amp;gt;&amp;lt;/url&amp;gt;
&amp;lt;headers&amp;gt;
&amp;lt;header name="Authorization"&amp;gt;Basic [insert-key-here]&amp;lt;/header&amp;gt;
&amp;lt;/headers&amp;gt;
&amp;lt;/request&amp;gt;
&amp;lt;/requests&amp;gt;
&amp;lt;generate&amp;gt;0&amp;lt;/generate&amp;gt;
&amp;lt;opcode&amp;gt;upsert&amp;lt;/opcode&amp;gt;
&amp;lt;event-loops&amp;gt;
&amp;lt;event-loop-json name='loop'&amp;gt;
&amp;lt;use-json&amp;gt;#_content&amp;lt;/use-json&amp;gt;
&amp;lt;json&amp;gt;$.index&amp;lt;/json&amp;gt;
&amp;lt;function-context&amp;gt;
&amp;lt;functions&amp;gt;
&amp;lt;function name='example'&amp;gt;json(#_context,'volume1.data')&amp;lt;/function&amp;gt;
&amp;lt;/functions&amp;gt;
&amp;lt;/function-context&amp;gt;
&amp;lt;/event-loop-json&amp;gt;
&amp;lt;/event-loops&amp;gt;
&amp;lt;/url-publisher&amp;gt;
&amp;lt;/url-publishers&amp;gt;
&amp;lt;/url-connector&amp;gt;&lt;/PRE&gt;&lt;P&gt;Hope someone with the same problem will have found this useful.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 10:08:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/Authentication-when-using-the-URL-Connector-to-query-data-from-a/m-p/913956#M309</guid>
      <dc:creator>VMoraal</dc:creator>
      <dc:date>2024-02-01T10:08:35Z</dc:date>
    </item>
  </channel>
</rss>

