<?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 Re: Getting json response from url. in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291692#M64848</link>
    <description>Thanks saburo for the idea. 
&lt;BR /&gt;I did use tFilefetch with this string " 
&lt;A href="http://myurl.com/api/v1/products" rel="nofollow noopener noreferrer"&gt;http://myurl.com/api/v1/products&lt;/A&gt;" and selecting Need Authentication in the advanced field worked. Which solves the problem of getting json but does not solve the problem of uploading a json file. 
&lt;BR /&gt;I tried tRest does not have the Need Authentication and doing "http://user 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MAB6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158321i00588DF41617C922/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MAB6.png" alt="0683p000009MAB6.png" /&gt;&lt;/span&gt;ass@myurl.com/api/v1/products" gives me a 401. In tRest I can specify what I send back in the http body but it won't authenticate.. 
&lt;BR /&gt; 
&lt;BR /&gt;I did try escaping the slashes and same thing. If it was an escape issue would forward slashes still cause it???</description>
    <pubDate>Thu, 19 Jan 2012 20:02:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-01-19T20:02:09Z</dc:date>
    <item>
      <title>Getting json response from url.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291690#M64846</link>
      <description>Hi all, 
&lt;BR /&gt;I am trying to get a json response by connecting to a url. Using tJson with URL selected yields a 401 error. Using tRest yields a 401 error as well. However the exact same url string returns me the correct json response in both curl and through my web browser. Not sure what else to try. 
&lt;BR /&gt;Here is the format of the URL I have used: 
&lt;BR /&gt;"&lt;A href="http://user" target="_blank"&gt;http://user&lt;/A&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MAB6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158321i00588DF41617C922/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MAB6.png" alt="0683p000009MAB6.png" /&gt;&lt;/span&gt;ass@myurl.com/api/v1/products" 
&lt;BR /&gt;"&lt;A href="https://user" target="_blank"&gt;https://user&lt;/A&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MAB6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158321i00588DF41617C922/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MAB6.png" alt="0683p000009MAB6.png" /&gt;&lt;/span&gt;ass@myurl.com/api/v1/products" 
&lt;BR /&gt; 
&lt;BR /&gt;Any help would be greatly appreciated.</description>
      <pubDate>Sat, 16 Nov 2024 12:26:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291690#M64846</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T12:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting json response from url.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291691#M64847</link>
      <description>You may have a problem with escape chars ( / ).</description>
      <pubDate>Thu, 19 Jan 2012 19:38:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291691#M64847</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-19T19:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Getting json response from url.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291692#M64848</link>
      <description>Thanks saburo for the idea. 
&lt;BR /&gt;I did use tFilefetch with this string " 
&lt;A href="http://myurl.com/api/v1/products" rel="nofollow noopener noreferrer"&gt;http://myurl.com/api/v1/products&lt;/A&gt;" and selecting Need Authentication in the advanced field worked. Which solves the problem of getting json but does not solve the problem of uploading a json file. 
&lt;BR /&gt;I tried tRest does not have the Need Authentication and doing "http://user 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MAB6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158321i00588DF41617C922/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MAB6.png" alt="0683p000009MAB6.png" /&gt;&lt;/span&gt;ass@myurl.com/api/v1/products" gives me a 401. In tRest I can specify what I send back in the http body but it won't authenticate.. 
&lt;BR /&gt; 
&lt;BR /&gt;I did try escaping the slashes and same thing. If it was an escape issue would forward slashes still cause it???</description>
      <pubDate>Thu, 19 Jan 2012 20:02:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291692#M64848</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-19T20:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Getting json response from url.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291693#M64849</link>
      <description>I found weird results with forward and backslashes, never really figured out the exact rule. 
&lt;BR /&gt;Something is happening sometimes because forward slashes are converted into backslashes for cross system compatibility (I guess). 
&lt;BR /&gt;Anyhow, it's not your case since with the same url you managed to get the json, plus 401 is specific to authentication. 
&lt;BR /&gt;REST authentication seems to be a bit more complex than sending username 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MAB6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158321i00588DF41617C922/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MAB6.png" alt="0683p000009MAB6.png" /&gt;&lt;/span&gt;assword@ 
&lt;BR /&gt;see here 
&lt;BR /&gt; 
&lt;A href="http://www.berenddeboer.net/rest/authentication.html" rel="nofollow noopener noreferrer"&gt;http://www.berenddeboer.net/rest/authentication.html&lt;/A&gt; 
&lt;BR /&gt;and here : 
&lt;BR /&gt; 
&lt;A href="https://developer.atlassian.com/display/FECRUDEV/Writing+a+REST+Client+in+Perl" rel="nofollow noopener noreferrer"&gt;https://developer.atlassian.com/display/FECRUDEV/Writing+a+REST+Client+in+Perl&lt;/A&gt; 
&lt;BR /&gt;I never used rests, so I cannot help with this one, but based on what I saw in the links, it seems you need to setup specific authentication headers which will contain username and password in base64 encoding... 
&lt;BR /&gt;If the component is not designed to do that... well, it may require a bit of work to extend it for that purpose.</description>
      <pubDate>Thu, 19 Jan 2012 20:53:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291693#M64849</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-19T20:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Getting json response from url.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291694#M64850</link>
      <description>Aha... 
&lt;BR /&gt;I have been trying to set the http headers but I don't really know what to put there and the RFC 2617 which explained it left me a little bit more confused. The base64 encoding is not a problem because I already have the string encoded. 
&lt;BR /&gt;In the tRest component I have tried: 
&lt;BR /&gt;URL : " 
&lt;A href="https://myurl.com/api/v1/products/" rel="nofollow noopener noreferrer"&gt;https://myurl.com/api/v1/products/&lt;/A&gt;" 
&lt;BR /&gt;HTTP METHOD: POST 
&lt;BR /&gt;HTTP HEADERS: 
&lt;BR /&gt;name value 
&lt;BR /&gt;"Authorization" "Basic encodedUserName:encodedPassword" -&amp;gt; I know these are the right credentials because copy paste onto browser returns json string as well as doing it through curl. 
&lt;BR /&gt;Http Body: 
&lt;BR /&gt;{ 
&lt;BR /&gt; price:19.99 
&lt;BR /&gt;} 
&lt;BR /&gt;But I get a 401. Does any one know/understand how to pass the credentials in an HTTP header? 
&lt;BR /&gt;By the way thank you for taking the time to help me out I really appreciate it.</description>
      <pubDate>Thu, 19 Jan 2012 21:07:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291694#M64850</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-19T21:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Getting json response from url.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291695#M64851</link>
      <description>I think I have exhausted other options. 
&lt;BR /&gt;So to write back a message via REST architecture I used the tJava component with the following code in it: 
&lt;BR /&gt; 
&lt;PRE&gt;try {&lt;BR /&gt; &lt;BR /&gt;		java.net.URL url = new java.net.URL("https://yourURL.com/api/v1/products/1/");//the 1 is the product id&lt;BR /&gt;		&lt;BR /&gt;		java.net.HttpURLConnection conn = (java.net.HttpURLConnection) url.openConnection();&lt;BR /&gt;		conn.setDoOutput(true);&lt;BR /&gt;		conn.setRequestMethod("PUT");&lt;BR /&gt;		conn.setRequestProperty("Content-Type", "application/json");&lt;BR /&gt;	&lt;BR /&gt;		&lt;BR /&gt;		String username = "someUser";&lt;BR /&gt;		String password = "somePassword";&lt;BR /&gt;		&lt;BR /&gt;	sun.misc.BASE64Encoder enc = new sun.misc.BASE64Encoder();&lt;BR /&gt;        String userpassword = username + ":" + password;&lt;BR /&gt;        String encodedAuthorization = enc.encode( userpassword.getBytes() );&lt;BR /&gt;        conn.setRequestProperty("Authorization", "Basic "+encodedAuthorization);&lt;BR /&gt; 		conn.setAllowUserInteraction(true);&lt;BR /&gt; 		&lt;BR /&gt; 		String input = "{\"available\":\"14\",\"price\": \"14.99\"}";&lt;BR /&gt;		&lt;BR /&gt; &lt;BR /&gt;		java.io.OutputStream os = conn.getOutputStream();&lt;BR /&gt;		os.write(input.getBytes());&lt;BR /&gt;		os.flush();&lt;BR /&gt;		os.close();&lt;BR /&gt;		/*if (conn.getResponseCode() != java.net.HttpURLConnection.HTTP_CREATED) {&lt;BR /&gt;			throw new RuntimeException("Failed : HTTP error code : "&lt;BR /&gt;				+ conn.getResponseCode());&lt;BR /&gt;		}&lt;BR /&gt; 		&lt;BR /&gt; 	&lt;BR /&gt; 		*/&lt;BR /&gt;		java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(&lt;BR /&gt;				(conn.getInputStream())));&lt;BR /&gt; 		&lt;BR /&gt;		String output;&lt;BR /&gt;		System.out.println("Output from Server .... \n");&lt;BR /&gt;		while ((output = br.readLine()) != null) {&lt;BR /&gt;			System.out.println(output);&lt;BR /&gt;		}&lt;BR /&gt; &lt;BR /&gt;		conn.disconnect();&lt;BR /&gt; 	}&lt;BR /&gt;	 catch (IOException e) {&lt;BR /&gt; &lt;BR /&gt;		e.printStackTrace();&lt;BR /&gt; &lt;BR /&gt;	 }&lt;/PRE&gt; 
&lt;BR /&gt;I hope someone finds this useful. Currently I don't have the time nor the know-how to extend the tRest component to make it work with credentials. But hopefully higher powers can.</description>
      <pubDate>Tue, 24 Jan 2012 00:04:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Getting-json-response-from-url/m-p/2291695#M64851</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-24T00:04:07Z</dc:date>
    </item>
  </channel>
</rss>

