<?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 Http Request POST to CKAN API in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337721#M106033</link>
    <description>Hi all, 
&lt;BR /&gt;I have to make an Http Request method POST to CKAN API. The CKAN API is&amp;nbsp; 
&lt;FONT size="4"&gt;ckan.logic.action.create.&lt;/FONT&gt; 
&lt;FONT size="3"&gt;package_create&lt;/FONT&gt;. Here the link&amp;nbsp; 
&lt;A href="http://docs.ckan.org/en/ckan-2.0.2/ckan.logic.action.create.html" target="_blank" rel="nofollow noopener noreferrer"&gt;http://docs.ckan.org/en/ckan-2.0.2/ckan.logic.action.create.html&lt;/A&gt; 
&lt;BR /&gt;I just tried the request with Advanced Rest Client, as shown in the figure and it works. Now, I want to make the request using Talend Studio. I am using the component tHttpRequest, as shown in the figure, but I don't know how the JSON fields should be set in the file "Post parameters".&amp;nbsp;In any manner I write the fields in the file, I get "400 bad request". Which is the correct way to set the JSON fields? 
&lt;BR /&gt;Thanks all. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBC0.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149715iD8229200441E1989/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBC0.png" alt="0683p000009MBC0.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBC5.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133834iB052C485C59078DF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBC5.png" alt="0683p000009MBC5.png" /&gt;&lt;/span&gt;</description>
    <pubDate>Sat, 16 Nov 2024 11:07:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-16T11:07:38Z</dc:date>
    <item>
      <title>Http Request POST to CKAN API</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337721#M106033</link>
      <description>Hi all, 
&lt;BR /&gt;I have to make an Http Request method POST to CKAN API. The CKAN API is&amp;nbsp; 
&lt;FONT size="4"&gt;ckan.logic.action.create.&lt;/FONT&gt; 
&lt;FONT size="3"&gt;package_create&lt;/FONT&gt;. Here the link&amp;nbsp; 
&lt;A href="http://docs.ckan.org/en/ckan-2.0.2/ckan.logic.action.create.html" target="_blank" rel="nofollow noopener noreferrer"&gt;http://docs.ckan.org/en/ckan-2.0.2/ckan.logic.action.create.html&lt;/A&gt; 
&lt;BR /&gt;I just tried the request with Advanced Rest Client, as shown in the figure and it works. Now, I want to make the request using Talend Studio. I am using the component tHttpRequest, as shown in the figure, but I don't know how the JSON fields should be set in the file "Post parameters".&amp;nbsp;In any manner I write the fields in the file, I get "400 bad request". Which is the correct way to set the JSON fields? 
&lt;BR /&gt;Thanks all. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBC0.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149715iD8229200441E1989/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBC0.png" alt="0683p000009MBC0.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBC5.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133834iB052C485C59078DF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBC5.png" alt="0683p000009MBC5.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Sat, 16 Nov 2024 11:07:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337721#M106033</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T11:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Http Request POST to CKAN API</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337722#M106034</link>
      <description>Hi, perhaps one option is to use tRESTClient with JSON posted as a String - that would be closest to the example with AdvancedRestClient
&lt;BR /&gt;Sergey</description>
      <pubDate>Tue, 28 Jul 2015 08:20:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337722#M106034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-28T08:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Http Request POST to CKAN API</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337723#M106035</link>
      <description>Hi, 
&lt;BR /&gt;I am trying with tRestClient, as shown in figure. I use tFileInputRaw in order to read the JSON from file as string. 
&lt;BR /&gt;I use tXMLMap in order to connect tFileInputRaw &amp;nbsp;and tRestCLient, as shown in figure. By default the schema that accept tRestClient as input is:&amp;nbsp; 
&lt;BR /&gt;body type Document, 
&lt;BR /&gt;string type String. 
&lt;BR /&gt;So, I map the content file to string. I don't know if it is correct. Then, I set tRestCLient as shown in figure. 
&lt;BR /&gt;But, when I run the Job, I get this error: 
&lt;BR /&gt; 
&lt;PRE&gt;Exception in component tRESTClient_1&lt;BR /&gt;javax.ws.rs.InternalServerErrorException&lt;BR /&gt;	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)&lt;BR /&gt;	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)&lt;BR /&gt;	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)&lt;BR /&gt;	at java.lang.reflect.Constructor.newInstance(Unknown Source)&lt;BR /&gt;	at org.apache.cxf.jaxrs.client.AbstractClient.convertToWebApplicationException(AbstractClient.java:463)&lt;BR /&gt;	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:881)&lt;BR /&gt;	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:852)&lt;BR /&gt;	at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:410)&lt;BR /&gt;	at org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:441)&lt;BR /&gt;	at scrape.restclient_0_1.restclient.tFileInputRaw_1Process(restclient.java:1181)&lt;BR /&gt;	at scrape.restclient_0_1.restclient.runJobInTOS(restclient.java:1637)&lt;BR /&gt;	at scrape.restclient_0_1.restclient.main(restclient.java:1496)&lt;/PRE&gt; 
&lt;BR /&gt;Where is the mistake? 
&lt;BR /&gt;Thanks. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8bd.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/135663iBAB8588772925389/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8bd.png" alt="0683p000009M8bd.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MB3U.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/142909i318A50DBF91D7596/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MB3U.png" alt="0683p000009MB3U.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MB4I.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/150447i7666FEB9DF589B66/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MB4I.png" alt="0683p000009MB4I.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBCA.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/136402i3A406750C320432A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBCA.png" alt="0683p000009MBCA.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Tue, 28 Jul 2015 09:34:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337723#M106035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-28T09:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Http Request POST to CKAN API</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337724#M106036</link>
      <description>Have you tried going to tRESTClient &amp;gt; Advanced Settings, and ticking the "Log messages" option? This will log the exact content of the REST request &amp;amp; response messages in the Console window, which should hopefully help debug the cause of the &lt;I&gt;javax.ws.rs.InternalServerErrorException&lt;/I&gt; you're getting.</description>
      <pubDate>Tue, 28 Jul 2015 10:33:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337724#M106036</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-28T10:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Http Request POST to CKAN API</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337725#M106037</link>
      <description>Hi, 
&lt;BR /&gt;Maybe I understand the problem. The output of tXMLMap is (body+string):&amp;nbsp; 
&lt;BR /&gt; 
&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;BR /&gt;&amp;lt;root/&amp;gt;|{ 	"name":"dataset-test",&lt;BR /&gt;  	"author":"vincentdj",&lt;BR /&gt;	"title":"Dataset Test",&lt;BR /&gt;	"author_email":"vincenzodj.it"&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;I do not know how it happened that by run several times the Job, the output has became like this (without the body): 
&lt;BR /&gt; 
&lt;PRE&gt;{ 	"name":"dataset-test",&lt;BR /&gt;  	"author":"vincentdj",&lt;BR /&gt;	"title":"Dataset Test",&lt;BR /&gt;	"author_email":"vincenzodj.it"&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;and it works correctly. But, If I delete voluntarily the body from tXMLMap, I get error on tRestClient schema that want body field, as shown in figure. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBCF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/150145i5B828457CF3494C1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBCF.png" alt="0683p000009MBCF.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Tue, 28 Jul 2015 10:49:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337725#M106037</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-28T10:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Http Request POST to CKAN API</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337726#M106038</link>
      <description>tRESTClient expects both 
&lt;B&gt;body &lt;/B&gt;(Document) and 
&lt;B&gt;string &lt;/B&gt;(String) columns, so you can't delete them. 
&lt;BR /&gt;The way around this is to make sure that the body column is completely empty in the input to the tRESTClient. If 
&lt;B&gt;body &lt;/B&gt;is empty, tRESTClient will use the content of 
&lt;B&gt;string&lt;/B&gt; when sending a POST request to the REST service. 
&lt;BR /&gt;Remove the tXMLMap because it's initialising the 
&lt;B&gt;body&lt;/B&gt; column with a Document containing a single &amp;lt;root&amp;gt; element, which you don't want. 
&lt;BR /&gt;Instead, remove the tXMLMap. Replace it with a tConvertType, to move the content of the 
&lt;B&gt;content&amp;nbsp; &lt;/B&gt;column from tFileInputRaw into the 
&lt;B&gt;string&lt;/B&gt; column for tRESTClient. So your flow looks something like this: 
&lt;BR /&gt; 
&lt;BR /&gt;tFileInputRaw --&amp;gt; tConvertType --&amp;gt; tRESTClient --&amp;gt; tLogRow 
&lt;BR /&gt;Settings on tConvertType should be: Auto Cast unticked, Input column "content" goes to output column "string". 
&lt;BR /&gt;I would post a screenshot but I don't have enough posts yet 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Tue, 28 Jul 2015 15:38:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Http-Request-POST-to-CKAN-API/m-p/2337726#M106038</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-28T15:38:12Z</dc:date>
    </item>
  </channel>
</rss>

